Class: Cucumber::Ast::Visitor

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/ast/visitor.rb

Overview

A dumb visitor that implements the whole Visitor API and just walks the tree.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step_mother) ⇒ Visitor

Returns a new instance of Visitor.



8
9
10
11
# File 'lib/cucumber/ast/visitor.rb', line 8

def initialize(step_mother)
  @options = {}
  @step_mother = step_mother
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/cucumber/ast/visitor.rb', line 5

def options
  @options
end

#step_motherObject (readonly)

Returns the value of attribute step_mother.



6
7
8
# File 'lib/cucumber/ast/visitor.rb', line 6

def step_mother
  @step_mother
end

Instance Method Details

#announce(announcement) ⇒ Object



112
113
# File 'lib/cucumber/ast/visitor.rb', line 112

def announce(announcement)
end

#matches_scenario_names?(node) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/cucumber/ast/visitor.rb', line 13

def matches_scenario_names?(node)
  scenario_name_regexps = options[:name_regexps] || []
  scenario_name_regexps.empty? || node.matches_scenario_names?(scenario_name_regexps)
end

#visit_background(background) ⇒ Object



48
49
50
# File 'lib/cucumber/ast/visitor.rb', line 48

def visit_background(background)
  background.accept(self)
end

#visit_background_name(keyword, name, file_colon_line, source_indent) ⇒ Object



52
53
# File 'lib/cucumber/ast/visitor.rb', line 52

def visit_background_name(keyword, name, file_colon_line, source_indent)
end

#visit_comment(comment) ⇒ Object



26
27
28
# File 'lib/cucumber/ast/visitor.rb', line 26

def visit_comment(comment)
  comment.accept(self)
end

#visit_comment_line(comment_line) ⇒ Object



30
31
# File 'lib/cucumber/ast/visitor.rb', line 30

def visit_comment_line(comment_line)
end

#visit_examples(examples) ⇒ Object



59
60
61
# File 'lib/cucumber/ast/visitor.rb', line 59

def visit_examples(examples)
  examples.accept(self)
end

#visit_examples_array(examples_array) ⇒ Object



55
56
57
# File 'lib/cucumber/ast/visitor.rb', line 55

def visit_examples_array(examples_array)
  examples_array.accept(self)
end

#visit_examples_name(keyword, name) ⇒ Object



63
64
# File 'lib/cucumber/ast/visitor.rb', line 63

def visit_examples_name(keyword, name)
end

#visit_exception(exception, status) ⇒ Object

:nodoc:



95
96
# File 'lib/cucumber/ast/visitor.rb', line 95

def visit_exception(exception, status) #:nodoc:
end

#visit_feature(feature) ⇒ Object



22
23
24
# File 'lib/cucumber/ast/visitor.rb', line 22

def visit_feature(feature)
  feature.accept(self)
end

#visit_feature_element(feature_element) ⇒ Object

feature_element is either Scenario or ScenarioOutline



44
45
46
# File 'lib/cucumber/ast/visitor.rb', line 44

def visit_feature_element(feature_element)
  feature_element.accept(self)
end

#visit_feature_name(name) ⇒ Object



40
41
# File 'lib/cucumber/ast/visitor.rb', line 40

def visit_feature_name(name)
end

#visit_features(features) ⇒ Object



18
19
20
# File 'lib/cucumber/ast/visitor.rb', line 18

def visit_features(features)
  features.accept(self)
end

#visit_multiline_arg(multiline_arg) ⇒ Object

:nodoc:



91
92
93
# File 'lib/cucumber/ast/visitor.rb', line 91

def visit_multiline_arg(multiline_arg) #:nodoc:
  multiline_arg.accept(self)
end

#visit_outline_table(outline_table) ⇒ Object



66
67
68
69
# File 'lib/cucumber/ast/visitor.rb', line 66

def visit_outline_table(outline_table)
  @table = outline_table
  outline_table.accept(self)
end

#visit_py_string(string) ⇒ Object



98
99
# File 'lib/cucumber/ast/visitor.rb', line 98

def visit_py_string(string)
end

#visit_scenario_name(keyword, name, file_colon_line, source_indent) ⇒ Object



71
72
# File 'lib/cucumber/ast/visitor.rb', line 71

def visit_scenario_name(keyword, name, file_colon_line, source_indent)
end

#visit_step(step) ⇒ Object



78
79
80
# File 'lib/cucumber/ast/visitor.rb', line 78

def visit_step(step)
  step.accept(self)
end

#visit_step_name(keyword, step_match, status, source_indent, background) ⇒ Object

:nodoc:



88
89
# File 'lib/cucumber/ast/visitor.rb', line 88

def visit_step_name(keyword, step_match, status, source_indent, background) #:nodoc:
end

#visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) ⇒ Object



82
83
84
85
86
# File 'lib/cucumber/ast/visitor.rb', line 82

def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
  visit_step_name(keyword, step_match, status, source_indent, background)
  visit_multiline_arg(multiline_arg) if multiline_arg
  visit_exception(exception, status) if exception
end

#visit_steps(steps) ⇒ Object



74
75
76
# File 'lib/cucumber/ast/visitor.rb', line 74

def visit_steps(steps)
  steps.accept(self)
end

#visit_table_cell(table_cell) ⇒ Object



105
106
107
# File 'lib/cucumber/ast/visitor.rb', line 105

def visit_table_cell(table_cell)
  table_cell.accept(self)
end

#visit_table_cell_value(value, status) ⇒ Object



109
110
# File 'lib/cucumber/ast/visitor.rb', line 109

def visit_table_cell_value(value, status)
end

#visit_table_row(table_row) ⇒ Object



101
102
103
# File 'lib/cucumber/ast/visitor.rb', line 101

def visit_table_row(table_row)
  table_row.accept(self)
end

#visit_tag_name(tag_name) ⇒ Object



37
38
# File 'lib/cucumber/ast/visitor.rb', line 37

def visit_tag_name(tag_name)
end

#visit_tags(tags) ⇒ Object



33
34
35
# File 'lib/cucumber/ast/visitor.rb', line 33

def visit_tags(tags)
  tags.accept(self)
end