Class: Skeptick::Command
- Inherits:
-
Object
- Object
- Skeptick::Command
- Defined in:
- lib/skeptick/command.rb
Instance Attribute Summary collapse
-
#shellwords ⇒ Object
readonly
Returns the value of attribute shellwords.
Instance Method Summary collapse
-
#initialize(shellwords) ⇒ Command
constructor
A new instance of Command.
- #run(spawn_options = {}) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(shellwords) ⇒ Command
Returns a new instance of Command.
9 10 11 |
# File 'lib/skeptick/command.rb', line 9 def initialize(shellwords) @shellwords = shellwords end |
Instance Attribute Details
#shellwords ⇒ Object (readonly)
Returns the value of attribute shellwords.
7 8 9 |
# File 'lib/skeptick/command.rb', line 7 def shellwords @shellwords end |
Instance Method Details
#run(spawn_options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/skeptick/command.rb', line 17 def run( = {}) opts = {} opts[:chdir] = Skeptick.cd_path.to_s if Skeptick.cd_path opts[:timeout] = Skeptick.timeout if Skeptick.timeout opts.merge() if Skeptick.debug_mode? Skeptick.log("Skeptick Command: #{to_s}") end im_process = POSIX::Spawn::Child.new(*shellwords, opts) if !im_process.success? raise ImageMagickError, "ImageMagick error\nCommand: #{to_s}\nSTDERR:\n#{im_process.err}" end im_process.status end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/skeptick/command.rb', line 13 def to_s shellwords.join(' ') end |