Class: TestBench::Telemetry::Sink::Capture::Record
- Inherits:
-
Struct
- Object
- Struct
- TestBench::Telemetry::Sink::Capture::Record
- Defined in:
- lib/test_bench/telemetry/sink/capture/record.rb,
lib/test_bench/telemetry/sink/capture/record/generate.rb
Defined Under Namespace
Classes: Generate
Instance Attribute Summary collapse
-
#detail_level ⇒ Object
Returns the value of attribute detail_level.
-
#event ⇒ Object
Returns the value of attribute event.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #block_match?(&block) ⇒ Boolean (also: #block?)
- #detail_level_match?(detail_level) ⇒ Boolean (also: #detail_level?)
- #detail_match?(match) ⇒ Boolean (also: #detail?)
- #match?(*path_segments, detail: nil, detail_level: nil, &block) ⇒ Boolean
- #path_segments_match?(*segments) ⇒ Boolean (also: #path_segments?)
Instance Attribute Details
#detail_level ⇒ Object
Returns the value of attribute detail_level
5 6 7 |
# File 'lib/test_bench/telemetry/sink/capture/record.rb', line 5 def detail_level @detail_level end |
#event ⇒ Object
Returns the value of attribute event
5 6 7 |
# File 'lib/test_bench/telemetry/sink/capture/record.rb', line 5 def event @event end |
#path ⇒ Object
Returns the value of attribute path
5 6 7 |
# File 'lib/test_bench/telemetry/sink/capture/record.rb', line 5 def path @path end |
Class Method Details
.build(event, path, detail_level) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/test_bench/telemetry/sink/capture/record.rb', line 6 def self.build(event, path, detail_level) instance = new instance.event = event instance.detail_level = detail_level path.copy(instance) instance end |
Instance Method Details
#block_match?(&block) ⇒ Boolean Also known as: block?
59 60 61 62 63 64 65 66 67 |
# File 'lib/test_bench/telemetry/sink/capture/record.rb', line 59 def block_match?(&block) if block.nil? true elsif block.(event.event_type, *event.values) true else false end end |
#detail_level_match?(detail_level) ⇒ Boolean Also known as: detail_level?
41 42 43 44 45 46 47 |
# File 'lib/test_bench/telemetry/sink/capture/record.rb', line 41 def detail_level_match?(detail_level) if detail_level.nil? true else detail_level == self.detail_level end end |
#detail_match?(match) ⇒ Boolean Also known as: detail?
30 31 32 33 34 35 36 37 38 |
# File 'lib/test_bench/telemetry/sink/capture/record.rb', line 30 def detail_match?(match) if match.nil? true elsif match detail_level > 0 else detail_level.zero? end end |
#match?(*path_segments, detail: nil, detail_level: nil, &block) ⇒ Boolean
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/test_bench/telemetry/sink/capture/record.rb', line 16 def match?(*path_segments, detail: nil, detail_level: nil, &block) if not path_segments?(*path_segments) false elsif not detail?(detail) false elsif not detail_level?(detail_level) false elsif not block?(&block) false else true end end |
#path_segments_match?(*segments) ⇒ Boolean Also known as: path_segments?
50 51 52 53 54 55 56 |
# File 'lib/test_bench/telemetry/sink/capture/record.rb', line 50 def path_segments_match?(*segments) if segments.empty? true else path.match?(*segments) end end |