Class: Guard::Openscad
Instance Attribute Summary collapse
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
Instance Method Summary collapse
-
#initialize(watches = [], options = {}) ⇒ Openscad
constructor
A new instance of Openscad.
- #run_all ⇒ Object
- #run_on_changes(paths) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(watches = [], options = {}) ⇒ Openscad
Returns a new instance of Openscad.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/guard/openscad.rb', line 14 def initialize(watches=[], = {}) super = {all_on_start: true, benchmark: false, runner: Scad4r::Runner, result_parser: Scad4r::ResultParser, format: :stl, notifier: Notifier, notification_parser: Scad4r::Notification}.merge() # Behaviour options @all_on_start = .fetch(:all_on_start) @benchmark = .fetch(:benchmark) @runner = build_runner() @notifier = .fetch(:notifier) @notification_parser = .fetch(:notification_parser) @failed = false end |
Instance Attribute Details
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
13 14 15 |
# File 'lib/guard/openscad.rb', line 13 def runner @runner end |
Instance Method Details
#run_all ⇒ Object
43 44 45 |
# File 'lib/guard/openscad.rb', line 43 def run_all run_on_changes(all_watched_files) end |
#run_on_changes(paths) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/guard/openscad.rb', line 47 def run_on_changes(paths) failed = false run_list(paths).each do |path| result = process(path) if result.has_key?(:error) || result.has_key?(:warning) failed = true end notifications = parse_results(result) notifications.each { |notification| notify(notification) } end if failed throw :task_has_failed end end |
#start ⇒ Object
39 40 41 |
# File 'lib/guard/openscad.rb', line 39 def start run_all if all_on_start? end |