Class: Cucumber::Ast::TreeWalker

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

Overview

Walks the AST, executing steps and notifying listeners

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step_mother, listeners = [], configuration = Cucumber::Configuration.default) ⇒ TreeWalker

Returns a new instance of TreeWalker.



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

def initialize(step_mother, listeners = [], configuration = Cucumber::Configuration.default)
  @step_mother, @listeners, @configuration = step_mother, listeners, configuration
end

Instance Attribute Details

#configurationObject

:nodoc:



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

def configuration
  @configuration
end

#step_motherObject (readonly)

:nodoc:



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

def step_mother
  @step_mother
end

Instance Method Details

#announce(announcement) ⇒ Object

Print announcement. This method can be called from within StepDefinitions.



146
147
148
# File 'lib/cucumber/ast/tree_walker.rb', line 146

def announce(announcement)
  broadcast(announcement)
end

#embed(file, mime_type) ⇒ Object

Embed file of mime_type in the formatter. This method can be called from within StepDefinitions. For most formatters this is a no-op.



152
153
154
# File 'lib/cucumber/ast/tree_walker.rb', line 152

def embed(file, mime_type)
  broadcast(file, mime_type)
end

#visit_background(background) ⇒ Object



55
56
57
58
59
# File 'lib/cucumber/ast/tree_walker.rb', line 55

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

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



61
62
63
# File 'lib/cucumber/ast/tree_walker.rb', line 61

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

#visit_comment(comment) ⇒ Object



24
25
26
27
28
# File 'lib/cucumber/ast/tree_walker.rb', line 24

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

#visit_comment_line(comment_line) ⇒ Object



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

def visit_comment_line(comment_line)
  broadcast(comment_line)
end

#visit_examples(examples) ⇒ Object



71
72
73
74
75
# File 'lib/cucumber/ast/tree_walker.rb', line 71

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

#visit_examples_array(examples_array) ⇒ Object



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

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

#visit_examples_name(keyword, name) ⇒ Object



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

def visit_examples_name(keyword, name)
  broadcast(keyword, name)
end

#visit_exception(exception, status) ⇒ Object

:nodoc:



121
122
123
# File 'lib/cucumber/ast/tree_walker.rb', line 121

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

#visit_feature(feature) ⇒ Object



18
19
20
21
22
# File 'lib/cucumber/ast/tree_walker.rb', line 18

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

#visit_feature_element(feature_element) ⇒ Object

feature_element is either Scenario or ScenarioOutline



49
50
51
52
53
# File 'lib/cucumber/ast/tree_walker.rb', line 49

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

#visit_feature_name(keyword, name) ⇒ Object



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

def visit_feature_name(keyword, name)
  broadcast(keyword, name)
end

#visit_features(features) ⇒ Object



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

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

#visit_multiline_arg(multiline_arg) ⇒ Object

:nodoc:



115
116
117
118
119
# File 'lib/cucumber/ast/tree_walker.rb', line 115

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

#visit_outline_table(outline_table) ⇒ Object



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

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

#visit_py_string(string) ⇒ Object



125
126
127
# File 'lib/cucumber/ast/tree_walker.rb', line 125

def visit_py_string(string)
  broadcast(string)
end

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



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

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

#visit_step(step) ⇒ Object



97
98
99
100
101
# File 'lib/cucumber/ast/tree_walker.rb', line 97

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

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

:nodoc:



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

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

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



103
104
105
106
107
108
109
# File 'lib/cucumber/ast/tree_walker.rb', line 103

def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
  broadcast(keyword, step_match, multiline_arg, status, exception, source_indent, background) do
    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
end

#visit_steps(steps) ⇒ Object



91
92
93
94
95
# File 'lib/cucumber/ast/tree_walker.rb', line 91

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

#visit_table_cell(table_cell) ⇒ Object



135
136
137
138
139
# File 'lib/cucumber/ast/tree_walker.rb', line 135

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

#visit_table_cell_value(value, status) ⇒ Object



141
142
143
# File 'lib/cucumber/ast/tree_walker.rb', line 141

def visit_table_cell_value(value, status)
  broadcast(value, status)
end

#visit_table_row(table_row) ⇒ Object



129
130
131
132
133
# File 'lib/cucumber/ast/tree_walker.rb', line 129

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

#visit_tag_name(tag_name) ⇒ Object



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

def visit_tag_name(tag_name)
  broadcast(tag_name)
end

#visit_tags(tags) ⇒ Object



34
35
36
37
38
# File 'lib/cucumber/ast/tree_walker.rb', line 34

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