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



1520
1521
1522
# File 'lib/oktest.rb', line 1520

def on_case(case_cond, tag, depth)
  yield
end

#on_scope(scope_filename, tag, depth) ⇒ Object



1512
1513
1514
# File 'lib/oktest.rb', line 1512

def on_scope(scope_filename, tag, depth)
  yield
end

#on_spec(spec_desc, tag, depth) ⇒ Object



1524
1525
# File 'lib/oktest.rb', line 1524

def on_spec(spec_desc, tag, depth)
end

#on_topic(topic_target, tag, depth) ⇒ Object



1516
1517
1518
# File 'lib/oktest.rb', line 1516

def on_topic(topic_target, tag, depth)
  yield
end

#startObject



1479
1480
1481
1482
1483
1484
# File 'lib/oktest.rb', line 1479

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:



1486
1487
1488
1489
1490
1491
# File 'lib/oktest.rb', line 1486

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:



1507
1508
1509
1510
# File 'lib/oktest.rb', line 1507

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:



1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
# File 'lib/oktest.rb', line 1493

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