Class: Oktest::Traverser

Inherits:
Visitor show all
Defined in:
lib/oktest.rb

Instance Method Summary collapse

Instance Method Details

#on_case(case_cond, tag, depth) ⇒ Object



1605
1606
1607
# File 'lib/oktest.rb', line 1605

def on_case(case_cond, tag, depth)
  yield
end

#on_scope(scope_filename, tag, depth) ⇒ Object



1597
1598
1599
# File 'lib/oktest.rb', line 1597

def on_scope(scope_filename, tag, depth)
  yield
end

#on_spec(spec_desc, tag, depth) ⇒ Object



1609
1610
# File 'lib/oktest.rb', line 1609

def on_spec(spec_desc, tag, depth)
end

#on_topic(topic_target, tag, depth) ⇒ Object



1601
1602
1603
# File 'lib/oktest.rb', line 1601

def on_topic(topic_target, tag, depth)
  yield
end

#startObject



1564
1565
1566
1567
1568
1569
# File 'lib/oktest.rb', line 1564

def start()
  #; [!5zonp] visits topics and specs and calls callbacks.
  #; [!gkopz] doesn't change Oktest::THE_GLOBAL_SCOPE.
  #visit_scope(THE_GLOBAL_SCOPE, -1, nil)
  THE_GLOBAL_SCOPE.each_child {|c| c.accept_visitor(self, 0, nil) }
end

#visit_scope(scope, depth, parent) ⇒ Object

:nodoc:



1571
1572
1573
1574
1575
1576
# File 'lib/oktest.rb', line 1571

def visit_scope(scope, depth, parent)  #:nodoc:
  #; [!ledj3] calls on_scope() callback on scope.
  on_scope(scope.filename, scope.tag, depth) do
    scope.each_child {|c| c.accept_visitor(self, depth+1, scope) }
  end
end

#visit_spec(spec, depth, parent) ⇒ Object

:nodoc:



1592
1593
1594
1595
# File 'lib/oktest.rb', line 1592

def visit_spec(spec, depth, parent)   #:nodoc:
  #; [!41uyj] calls on_spec() callback.
  on_spec(spec.desc, spec.tag, depth)
end

#visit_topic(topic, depth, parent) ⇒ Object

:nodoc:



1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
# File 'lib/oktest.rb', line 1578

def visit_topic(topic, depth, parent)   #:nodoc:
  #; [!x8r9w] calls on_topic() callback on topic.
  if topic._prefix == '*'
    on_topic(topic.target, topic.tag, depth) do
      topic.each_child {|c| c.accept_visitor(self, depth+1, topic) }
    end
  #; [!qh0q3] calls on_case() callback on case_when or case_else.
  else
    on_case(topic.target, topic.tag, depth) do
      topic.each_child {|c| c.accept_visitor(self, depth+1, topic) }
    end
  end
end