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
12
# File 'lib/cucumber/ast/visitor.rb', line 8

def initialize(step_mother)
  @options = {}
  @step_mother = step_mother
  @current_feature_lines = []
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



120
121
# File 'lib/cucumber/ast/visitor.rb', line 120

def announce(announcement)
end

#current_feature_lines=(lines) ⇒ Object



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

def current_feature_lines=(lines)
  @current_feature_lines = lines
end

#excluded_by_tags?(node) ⇒ Boolean

Returns:

  • (Boolean)


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

def excluded_by_tags?(node)
  tags = options[:exclude_tags] || []
  tags.any? && node.has_tags?(tags)
end

#included_by_tags?(node) ⇒ Boolean

Returns:

  • (Boolean)


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

def included_by_tags?(node)
  tags = options[:include_tags] || []
  tags.empty? || node.has_tags?(tags)
end

#matches_lines?(node) ⇒ Boolean

Returns:

  • (Boolean)


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

def matches_lines?(node)
  @current_feature_lines.empty? || node.matches_lines?(@current_feature_lines)
end

#matches_scenario_names?(node) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#visit_background(background) ⇒ Object



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

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

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



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

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

#visit_comment(comment) ⇒ Object



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

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

#visit_comment_line(comment_line) ⇒ Object



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

def visit_comment_line(comment_line)
end

#visit_examples(examples) ⇒ Object



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

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

#visit_examples_name(keyword, name) ⇒ Object



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

def visit_examples_name(keyword, name)
end

#visit_exception(exception, status) ⇒ Object



117
118
# File 'lib/cucumber/ast/visitor.rb', line 117

def visit_exception(exception, status)
end

#visit_feature(feature) ⇒ Object



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

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

#visit_feature_element(feature_element) ⇒ Object

feature_element is either Scenario or ScenarioOutline



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

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

#visit_feature_name(name) ⇒ Object



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

def visit_feature_name(name)
end

#visit_features(features) ⇒ Object



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

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

#visit_multiline_arg(multiline_arg) ⇒ Object



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

def visit_multiline_arg(multiline_arg)
  multiline_arg.accept(self)
end

#visit_outline_table(outline_table) ⇒ Object



81
82
83
# File 'lib/cucumber/ast/visitor.rb', line 81

def visit_outline_table(outline_table)
  outline_table.accept(self)
end

#visit_py_string(string, status) ⇒ Object



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

def visit_py_string(string, status)
end

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



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

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

#visit_step(step) ⇒ Object



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

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

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



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

def visit_step_name(keyword, step_match, status, source_indent, background)
end

#visit_steps(steps) ⇒ Object



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

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

#visit_table_cell(table_cell) ⇒ Object



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

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

#visit_table_cell_value(value, width, status) ⇒ Object



114
115
# File 'lib/cucumber/ast/visitor.rb', line 114

def visit_table_cell_value(value, width, status)
end

#visit_table_row(table_row) ⇒ Object



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

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

#visit_tag_name(tag_name) ⇒ Object



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

def visit_tag_name(tag_name)
end

#visit_tags(tags) ⇒ Object



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

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