Class: Bulldogger::Instance

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(config: Config.new) ⇒ Instance

Returns a new instance of Instance.



17
18
19
# File 'lib/bulldogger/instance.rb', line 17

def initialize(config: Config.new)
  @config = config
end

Instance Attribute Details

#configObject (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

Yields:



21
22
23
24
# File 'lib/bulldogger/instance.rb', line 21

def configure
  yield config
  self
end

#finishObject



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_startObject



74
75
76
# File 'lib/bulldogger/instance.rb', line 74

def record_start
  Record.start(instance: self)
end

#run_dirObject



50
51
52
# File 'lib/bulldogger/instance.rb', line 50

def run_dir
  run.dir
end

#running?Boolean

Returns:

  • (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

#startObject



26
27
28
29
30
31
# File 'lib/bulldogger/instance.rb', line 26

def start
  return self unless config.enabled

  capture.start
  self
end

#stopObject



33
34
35
36
# File 'lib/bulldogger/instance.rb', line 33

def stop
  capture.stop
  self
end

#trace_to_sqlite(jsonl_path, db_path) ⇒ Object



78
79
80
# File 'lib/bulldogger/instance.rb', line 78

def trace_to_sqlite(jsonl_path, db_path)
  Record.to_sqlite(jsonl_path, db_path)
end