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



1190
1191
1192
# File 'lib/oktest.rb', line 1190

def on_case(case_cond, tag, depth)
  yield
end

#on_scope(scope_filename, tag, depth) ⇒ Object



1182
1183
1184
# File 'lib/oktest.rb', line 1182

def on_scope(scope_filename, tag, depth)
  yield
end

#on_spec(spec_desc, tag, depth) ⇒ Object



1194
1195
# File 'lib/oktest.rb', line 1194

def on_spec(spec_desc, tag, depth)
end

#on_topic(topic_target, tag, depth) ⇒ Object



1186
1187
1188
# File 'lib/oktest.rb', line 1186

def on_topic(topic_target, tag, depth)
  yield
end

#startObject



1149
1150
1151
1152
1153
1154
# File 'lib/oktest.rb', line 1149

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:



1156
1157
1158
1159
1160
1161
# File 'lib/oktest.rb', line 1156

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:



1177
1178
1179
1180
# File 'lib/oktest.rb', line 1177

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:



1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
# File 'lib/oktest.rb', line 1163

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