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



1471
1472
1473
# File 'lib/oktest.rb', line 1471

def on_case(case_cond, tag, depth)
  yield
end

#on_scope(scope_filename, tag, depth) ⇒ Object



1463
1464
1465
# File 'lib/oktest.rb', line 1463

def on_scope(scope_filename, tag, depth)
  yield
end

#on_spec(spec_desc, tag, depth) ⇒ Object



1475
1476
# File 'lib/oktest.rb', line 1475

def on_spec(spec_desc, tag, depth)
end

#on_topic(topic_target, tag, depth) ⇒ Object



1467
1468
1469
# File 'lib/oktest.rb', line 1467

def on_topic(topic_target, tag, depth)
  yield
end

#startObject



1430
1431
1432
1433
1434
1435
# File 'lib/oktest.rb', line 1430

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:



1437
1438
1439
1440
1441
1442
# File 'lib/oktest.rb', line 1437

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:



1458
1459
1460
1461
# File 'lib/oktest.rb', line 1458

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:



1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
# File 'lib/oktest.rb', line 1444

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