Class: Scad4r::Runner
- Inherits:
-
Object
- Object
- Scad4r::Runner
- Defined in:
- lib/scad4r/runner.rb
Defined Under Namespace
Classes: PassThrough
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #run(path, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Runner
Returns a new instance of Runner.
11 12 13 14 15 16 |
# File 'lib/scad4r/runner.rb', line 11 def initialize( = {}) @options = {format: :stl, constants: {}, parser: PassThrough.new, timed: true}.merge() end |
Instance Method Details
#run(path, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/scad4r/runner.rb', line 18 def run(path, = {}) = @options.merge() parser = .fetch(:parser) # provide a reasonable default = {output: output_file(path, )}.merge() io = shell_out(openscad_invocation(path, )) result_hash = parser.parse io.read result_hash.merge({output: .fetch(:output)}) end |