Class: TestBench::Session::Trace
- Inherits:
-
Object
- Object
- TestBench::Session::Trace
- Includes:
- Enumerable
- Defined in:
- lib/test_bench/session/trace.rb
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
- #each ⇒ Object
- #join(delimiter = nil) ⇒ Object
- #match?(*context_titles, compare_text) ⇒ Boolean
- #pop ⇒ Object
- #push(entry) ⇒ Object
Instance Attribute Details
#entries ⇒ Object
6 7 8 |
# File 'lib/test_bench/session/trace.rb', line 6 def entries @entries ||= [] end |
Class Method Details
.join_delimiter ⇒ Object
46 47 48 |
# File 'lib/test_bench/session/trace.rb', line 46 def self.join_delimiter ' :: ' end |
Instance Method Details
#each ⇒ Object
36 37 38 |
# File 'lib/test_bench/session/trace.rb', line 36 def each(...) entries.each(...) end |
#join(delimiter = nil) ⇒ Object
40 41 42 43 44 |
# File 'lib/test_bench/session/trace.rb', line 40 def join(delimiter=nil) delimiter ||= self.class.join_delimiter entries.join(delimiter) end |
#match?(*context_titles, compare_text) ⇒ Boolean
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/test_bench/session/trace.rb', line 19 def match?(*context_titles, compare_text) if compare_text != entries.last return false end context_title_iterator = entries[0...-1].to_enum context_titles.all? do |context_title| title = context_title_iterator.next until title == context_title true rescue StopIteration false end end |
#pop ⇒ Object
15 16 17 |
# File 'lib/test_bench/session/trace.rb', line 15 def pop entries.pop end |
#push(entry) ⇒ Object
11 12 13 |
# File 'lib/test_bench/session/trace.rb', line 11 def push(entry) entries.push(entry) end |