Class: Assert::Config
- Inherits:
-
Object
- Object
- Assert::Config
- Defined in:
- lib/assert/config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #apply(settings) ⇒ Object
-
#initialize(settings = nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(settings = nil) ⇒ Config
Returns a new instance of Config.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/assert/config.rb', line 22 def initialize(settings = nil) @suite = Assert::Suite.new(self) @view = Assert::View::DefaultView.new($stdout, self, @suite) @runner = Assert::Runner.new(self) @test_dir = "test" @test_helper = "helper.rb" @test_file_suffixes = ['_tests.rb', '_test.rb'] @runner_seed = begin; srand; srand % 0xFFFF; end.to_i @changed_proc = Assert::U.git_changed_proc @pp_proc = Assert::U.stdlib_pp_proc @use_diff_proc = Assert::U.default_use_diff_proc @run_diff_proc = Assert::U.syscmd_diff_proc # mode flags @capture_output = false @halt_on_fail = true @changed_only = false @pp_objects = false @debug = false @profile = false @verbose = false self.apply(settings || {}) end |
Class Method Details
.settings(*items) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/assert/config.rb', line 5 def self.settings(*items) items.each do |item| define_method(item) do |*args| if !(value = args.size > 1 ? args : args.first).nil? instance_variable_set("@#{item}", value) end instance_variable_get("@#{item}") end end end |
Instance Method Details
#apply(settings) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/assert/config.rb', line 49 def apply(settings) settings.keys.each do |name| if !settings[name].nil? && self.respond_to?(name.to_s) self.send(name.to_s, settings[name]) end end end |