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



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

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:



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

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:



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

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

#visit_outline_table(outline_table) ⇒ Object



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

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

#visit_py_string(string) ⇒ Object



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

def visit_py_string(string)
end

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



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

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

#visit_step(step) ⇒ Object



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

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

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

:nodoc:



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

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



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

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



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

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

#visit_table_cell(table_cell) ⇒ Object



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

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

#visit_table_cell_value(value, width, status) ⇒ Object



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

def visit_table_cell_value(value, width, status)
end

#visit_table_row(table_row) ⇒ Object



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

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