Class: RScale::Processor::Convert
- Inherits:
-
Object
- Object
- RScale::Processor::Convert
- Defined in:
- lib/rscale/processor.rb
Instance Attribute Summary collapse
-
#file_from ⇒ Object
readonly
Returns the value of attribute file_from.
-
#file_to ⇒ Object
readonly
Returns the value of attribute file_to.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #add(param, value) ⇒ Object
- #execute ⇒ Object
-
#initialize(file_from, file_to) {|_self| ... } ⇒ Convert
constructor
A new instance of Convert.
Constructor Details
#initialize(file_from, file_to) {|_self| ... } ⇒ Convert
Returns a new instance of Convert.
12 13 14 15 16 17 |
# File 'lib/rscale/processor.rb', line 12 def initialize(file_from, file_to) @file_from = File.(file_from) @file_to = File.(file_to) = [] yield self if block_given? end |
Instance Attribute Details
#file_from ⇒ Object (readonly)
Returns the value of attribute file_from.
9 10 11 |
# File 'lib/rscale/processor.rb', line 9 def file_from @file_from end |
#file_to ⇒ Object (readonly)
Returns the value of attribute file_to.
9 10 11 |
# File 'lib/rscale/processor.rb', line 9 def file_to @file_to end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/rscale/processor.rb', line 10 def end |
Instance Method Details
#add(param, value) ⇒ Object
19 20 21 |
# File 'lib/rscale/processor.rb', line 19 def add(param, value) << "-#{param.to_s} '#{value}'" end |
#execute ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rscale/processor.rb', line 23 def execute unless File.exists?(File.dirname(@file_to)) File.makedirs(File.dirname(@file_to)) end `convert #{@file_from.shellescape} #{@options.join(' ')} #{@file_to.shellescape} 2>&1` end |