Class: Bulldogger::Instance
- Inherits:
-
Object
- Object
- Bulldogger::Instance
- Defined in:
- lib/bulldogger/instance.rb
Overview
Owns one independent capture, run, and evidence lifecycle. One module singleton cannot serve as the reset subject and the outer observer. A separate instance lets a test suite reset the subject while the observer stays active. This class does not define file schemas or serialization.
Each instance keeps its own :raise subscription. Two subscriptions fired independently in measurements, and disabling one left the other active. Each subscription cost about 0.03 microseconds per raise. A shared dispatcher would add a registry and lifecycle coordination without a measured need.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #configure {|config| ... } ⇒ Object
- #finish ⇒ Object
-
#initialize(config: Config.new) ⇒ Instance
constructor
A new instance of Instance.
- #probe(*target_strings, &block) ⇒ Object
- #probe_compare(path_a, path_b) ⇒ Object
- #probe_start(*target_strings) ⇒ Object
- #record(&block) ⇒ Object
- #record_failure(exception:, test:) ⇒ Object
- #record_start ⇒ Object
- #run_dir ⇒ Object
- #running? ⇒ Boolean
- #snapshot_for(exception) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #trace_to_sqlite(jsonl_path, db_path) ⇒ Object
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
15 16 17 |
# File 'lib/bulldogger/instance.rb', line 15 def config @config end |
Instance Method Details
#configure {|config| ... } ⇒ Object
21 22 23 24 |
# File 'lib/bulldogger/instance.rb', line 21 def configure yield config self end |
#finish ⇒ Object
54 55 56 |
# File 'lib/bulldogger/instance.rb', line 54 def finish run.finish end |
#probe(*target_strings, &block) ⇒ Object
58 59 60 |
# File 'lib/bulldogger/instance.rb', line 58 def probe(*target_strings, &block) Probe.call(target_strings, config: config, run: run, &block) end |
#probe_compare(path_a, path_b) ⇒ Object
66 67 68 |
# File 'lib/bulldogger/instance.rb', line 66 def probe_compare(path_a, path_b) Probe.compare(path_a, path_b) end |
#probe_start(*target_strings) ⇒ Object
62 63 64 |
# File 'lib/bulldogger/instance.rb', line 62 def probe_start(*target_strings) Probe.start(target_strings, config: config, run: run) end |
#record(&block) ⇒ Object
70 71 72 |
# File 'lib/bulldogger/instance.rb', line 70 def record(&block) Record.run(instance: self, &block) end |
#record_failure(exception:, test:) ⇒ Object
46 47 48 |
# File 'lib/bulldogger/instance.rb', line 46 def record_failure(exception:, test:) evidence.record_failure(exception: exception, test: test) end |
#record_start ⇒ Object
74 75 76 |
# File 'lib/bulldogger/instance.rb', line 74 def record_start Record.start(instance: self) end |
#run_dir ⇒ Object
50 51 52 |
# File 'lib/bulldogger/instance.rb', line 50 def run_dir run.dir end |
#running? ⇒ Boolean
38 39 40 |
# File 'lib/bulldogger/instance.rb', line 38 def running? capture.running? end |
#snapshot_for(exception) ⇒ Object
42 43 44 |
# File 'lib/bulldogger/instance.rb', line 42 def snapshot_for(exception) capture.snapshot_for(exception) end |
#start ⇒ Object
26 27 28 29 30 31 |
# File 'lib/bulldogger/instance.rb', line 26 def start return self unless config.enabled capture.start self end |
#stop ⇒ Object
33 34 35 36 |
# File 'lib/bulldogger/instance.rb', line 33 def stop capture.stop self end |