Class: Cucumber::Parser::GherkinBuilder
- Inherits:
-
Object
- Object
- Cucumber::Parser::GherkinBuilder
show all
- Includes:
- Gherkin::Rubify
- Defined in:
- lib/cucumber/parser/gherkin_builder.rb
Overview
This class conforms to the Gherkin event API and builds the “legacy” AST. It will be replaced later when we have a new “clean” AST.
Defined Under Namespace
Classes: BackgroundBuilder, Builder, FeatureBuilder, ScenarioBuilder, ScenarioOutlineBuilder, StepBuilder
Instance Method Summary
collapse
Constructor Details
#initialize(path = 'UNKNOWN-FILE') ⇒ GherkinBuilder
Returns a new instance of GherkinBuilder.
14
15
16
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 14
def initialize(path = 'UNKNOWN-FILE')
@path = path
end
|
Instance Method Details
#background(node) ⇒ Object
35
36
37
38
39
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 35
def background(node)
builder = BackgroundBuilder.new(file, node)
@feature_builder.background_builder = builder
@current = builder
end
|
70
71
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 70
def eof
end
|
#examples(examples) ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 53
def examples(examples)
examples_fields = [
Ast::Location.new(file, examples.line),
Ast::Comment.new(examples..map{|| .value}.join("\n")),
examples.keyword,
examples.name,
examples.description,
matrix(examples.rows)
]
@current.add_examples examples_fields, examples
end
|
#feature(node) ⇒ Object
31
32
33
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 31
def feature(node)
@feature_builder = FeatureBuilder.new(file, node)
end
|
#language=(language) ⇒ Object
23
24
25
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 23
def language=(language)
@language = language
end
|
18
19
20
21
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 18
def result
return nil unless @feature_builder
@feature_builder.result(language)
end
|
#scenario(node) ⇒ Object
41
42
43
44
45
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 41
def scenario(node)
builder = ScenarioBuilder.new(file, node)
@feature_builder.add_child builder
@current = builder
end
|
#scenario_outline(node) ⇒ Object
47
48
49
50
51
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 47
def scenario_outline(node)
builder = ScenarioOutlineBuilder.new(file, node)
@feature_builder.add_child builder
@current = builder
end
|
#step(node) ⇒ Object
65
66
67
68
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 65
def step(node)
builder = StepBuilder.new(file, node)
@current.add_child builder
end
|
#syntax_error(state, event, legal_events, line) ⇒ Object
73
74
75
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 73
def syntax_error(state, event, legal_events, line)
end
|
27
28
29
|
# File 'lib/cucumber/parser/gherkin_builder.rb', line 27
def uri(uri)
@path = uri
end
|