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

#begin_testObject



47
48
49
# File 'lib/bulldogger/instance.rb', line 47

def begin_test
  capture.begin_test
end

#configure {|config| ... } ⇒ Object

Yields:



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

def configure
  yield config
  self
end

#end_testObject



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

def end_test
  capture.end_test
end

#finishObject



63
64
65
# File 'lib/bulldogger/instance.rb', line 63

def finish
  run.finish
end

#probe(*target_strings, &block) ⇒ Object



67
68
69
# File 'lib/bulldogger/instance.rb', line 67

def probe(*target_strings, &block)
  Probe.call(target_strings, config: config, run: run, &block)
end

#probe_compare(path_a, path_b) ⇒ Object



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

def probe_compare(path_a, path_b)
  Probe.compare(path_a, path_b)
end

#probe_start(*target_strings) ⇒ Object



71
72
73
# File 'lib/bulldogger/instance.rb', line 71

def probe_start(*target_strings)
  Probe.start(target_strings, config: config, run: run)
end

#record_failure(exception:, test:) ⇒ Object



55
56
57
# File 'lib/bulldogger/instance.rb', line 55

def record_failure(exception:, test:)
  evidence.record_failure(exception: exception, test: test)
end

#run_dirObject



59
60
61
# File 'lib/bulldogger/instance.rb', line 59

def run_dir
  run.dir
end

#running?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/bulldogger/instance.rb', line 39

def running?
  capture.running?
end

#snapshot_for(exception) ⇒ Object



43
44
45
# File 'lib/bulldogger/instance.rb', line 43

def snapshot_for(exception)
  capture.snapshot_for(exception)
end

#startObject



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

def start
  return self unless config.enabled

  code_state
  capture.start
  self
end

#stopObject



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

def stop
  capture.stop
  self
end