Class: Dashy::Runner
- Inherits:
-
Object
- Object
- Dashy::Runner
- Defined in:
- lib/dashy/runner.rb
Class Method Summary collapse
Instance Method Summary collapse
- #block_to_run(&block) ⇒ Object
- #run ⇒ Object
- #valid_response?(&block) ⇒ Boolean
- #with_options(options = {}) ⇒ Object
Class Method Details
.config_and_run {|runner| ... } ⇒ Object
10 11 12 13 14 |
# File 'lib/dashy/runner.rb', line 10 def self.config_and_run runner = Dashy::Runner.new yield runner runner.run end |
.run_and_report_status_for(&block) ⇒ Object
4 5 6 7 8 |
# File 'lib/dashy/runner.rb', line 4 def self.run_and_report_status_for &block Dashy::Runner.config_and_run do |runner| runner.block_to_run &block end end |
Instance Method Details
#block_to_run(&block) ⇒ Object
16 17 18 |
# File 'lib/dashy/runner.rb', line 16 def block_to_run &block @block_to_run = block end |
#run ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dashy/runner.rb', line 28 def run raise 'Please before running Dashy you need to set the block_to_run' unless @block_to_run begin response = @block_to_run.call Dashy::RestInterface.report_status(({:success => valid_response_after_calling_block?(response)}).merge()) return response rescue StandardError => e Dashy::RestInterface.report_status(({:success => false}).merge()) raise end end |
#valid_response?(&block) ⇒ Boolean
24 25 26 |
# File 'lib/dashy/runner.rb', line 24 def valid_response? &block @valid_response_block = block end |
#with_options(options = {}) ⇒ Object
20 21 22 |
# File 'lib/dashy/runner.rb', line 20 def = {} @options = end |