Class: Autowatchr::Config
- Inherits:
-
Object
- Object
- Autowatchr::Config
- Defined in:
- lib/autowatchr.rb
Instance Attribute Summary collapse
- #command ⇒ Object
- #completed_re ⇒ Object
- #failed_results_re ⇒ Object
- #failing_only ⇒ Object
- #include ⇒ Object
- #lib_dir ⇒ Object
- #lib_re ⇒ Object
- #ruby ⇒ Object
- #run_suite ⇒ Object
- #test_dir ⇒ Object
- #test_re ⇒ Object
Instance Method Summary collapse
- #eval_command(predicate) ⇒ Object
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/autowatchr.rb', line 8 def initialize( = {}) @failing_only = @run_suite = true .each_pair do |key, value| method = "#{key}=" if self.respond_to?(method) self.send(method, value) end end end |
Instance Attribute Details
#command ⇒ Object
19 20 21 |
# File 'lib/autowatchr.rb', line 19 def command @command ||= "<%= ruby %> -I<%= include %> <%= predicate %>" end |
#completed_re ⇒ Object
51 52 53 |
# File 'lib/autowatchr.rb', line 51 def completed_re @completed_re ||= /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/ end |
#failed_results_re ⇒ Object
47 48 49 |
# File 'lib/autowatchr.rb', line 47 def failed_results_re @failed_results_re ||= /^\s+\d+\) (?:Failure|Error):\n(.*?)\((.*?)\)/ end |
#failing_only ⇒ Object
55 56 57 |
# File 'lib/autowatchr.rb', line 55 def failing_only @failing_only end |
#include ⇒ Object
27 28 29 |
# File 'lib/autowatchr.rb', line 27 def include @include ||= ".:#{self.lib_dir}:#{self.test_dir}" end |
#lib_dir ⇒ Object
31 32 33 |
# File 'lib/autowatchr.rb', line 31 def lib_dir @lib_dir ||= "lib" end |
#lib_re ⇒ Object
39 40 41 |
# File 'lib/autowatchr.rb', line 39 def lib_re @lib_re ||= '^%s.*/.*\.rb$' % self.lib_dir end |
#ruby ⇒ Object
23 24 25 |
# File 'lib/autowatchr.rb', line 23 def ruby @ruby ||= "ruby" end |
#run_suite ⇒ Object
59 60 61 |
# File 'lib/autowatchr.rb', line 59 def run_suite @run_suite end |
#test_dir ⇒ Object
35 36 37 |
# File 'lib/autowatchr.rb', line 35 def test_dir @test_dir ||= "test" end |
#test_re ⇒ Object
43 44 45 |
# File 'lib/autowatchr.rb', line 43 def test_re @test_re ||= '^%s.*/test_.*\.rb$' % self.test_dir end |
Instance Method Details
#eval_command(predicate) ⇒ Object
63 64 65 |
# File 'lib/autowatchr.rb', line 63 def eval_command(predicate) ERB.new(self.command).result(binding) end |