Class: Tengu::Runner
- Inherits:
-
Object
- Object
- Tengu::Runner
- Defined in:
- lib/tengu/runner.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #notify(event, object) ⇒ Object
- #record_override(object, method) ⇒ Object
- #run(ios, formatters = []) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Runner
Returns a new instance of Runner.
3 4 5 6 |
# File 'lib/tengu/runner.rb', line 3 def initialize( = {}) @options = @overrides = [] end |
Instance Method Details
#notify(event, object) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/tengu/runner.rb', line 8 def notify(event, object) case event when :finished_case then reset_overrides when :override then record_override(*object) end end |
#record_override(object, method) ⇒ Object
24 25 26 |
# File 'lib/tengu/runner.rb', line 24 def record_override(object, method) @overrides << [object, method] end |
#run(ios, formatters = []) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/tengu/runner.rb', line 15 def run(ios, formatters = []) @files = ios.map { |io| Tengu::File.new(io) } formatters.each { |formatter| formatter.notify(:started, self) } @files.each { |file| file.run([self] + formatters) } result = Result.new(@files) formatters.each { |formatter| formatter.notify(:finished, result) } result end |