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



1493
1494
1495
# File 'lib/oktest.rb', line 1493

def on_case(case_cond, tag, depth)
  yield
end

#on_scope(scope_filename, tag, depth) ⇒ Object



1485
1486
1487
# File 'lib/oktest.rb', line 1485

def on_scope(scope_filename, tag, depth)
  yield
end

#on_spec(spec_desc, tag, depth) ⇒ Object



1497
1498
# File 'lib/oktest.rb', line 1497

def on_spec(spec_desc, tag, depth)
end

#on_topic(topic_target, tag, depth) ⇒ Object



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

def on_topic(topic_target, tag, depth)
  yield
end

#startObject



1452
1453
1454
1455
1456
1457
# File 'lib/oktest.rb', line 1452

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:



1459
1460
1461
1462
1463
1464
# File 'lib/oktest.rb', line 1459

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:



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

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:



1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
# File 'lib/oktest.rb', line 1466

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