Object
Adapter from the “raw” Gherkin Listener API to the slightly more high-level Formatter API, which is easier to implement (less state to keep track of).
# File lib/gherkin/listener/formatter_listener.rb, line 31
31: def background(keyword, name, description, line)
32: @formatter.background(Formatter::Model::Background.new(grab_comments!, keyword, name, description, line))
33: end
# File lib/gherkin/listener/formatter_listener.rb, line 64
64: def eof
65: replay_step_or_examples
66: @formatter.eof
67: end
# File lib/gherkin/listener/formatter_listener.rb, line 45
45: def examples(keyword, name, description, line)
46: replay_step_or_examples
47: @examples_statement = Formatter::Model::Examples.new(grab_comments!, grab_tags!, keyword, name, description, line)
48: end
# File lib/gherkin/listener/formatter_listener.rb, line 27
27: def feature(keyword, name, description, line)
28: @formatter.feature(Formatter::Model::Feature.new(grab_comments!, grab_tags!, keyword, name, description, line))
29: end
# File lib/gherkin/listener/formatter_listener.rb, line 60
60: def py_string(string, line)
61: @py_string = Formatter::Model::PyString.new(string, line)
62: end
# File lib/gherkin/listener/formatter_listener.rb, line 55
55: def row(cells, line)
56: @table ||= []
57: @table << Formatter::Model::Row.new(grab_comments!, cells, line)
58: end
# File lib/gherkin/listener/formatter_listener.rb, line 35
35: def scenario(keyword, name, description, line)
36: replay_step_or_examples
37: @formatter.scenario(Formatter::Model::Scenario.new(grab_comments!, grab_tags!, keyword, name, description, line))
38: end
# File lib/gherkin/listener/formatter_listener.rb, line 40
40: def scenario_outline(keyword, name, description, line)
41: replay_step_or_examples
42: @formatter.scenario_outline(Formatter::Model::ScenarioOutline.new(grab_comments!, grab_tags!, keyword, name, description, line))
43: end
# File lib/gherkin/listener/formatter_listener.rb, line 50
50: def step(keyword, name, line)
51: replay_step_or_examples
52: @step_statement = Formatter::Model::Step.new(grab_comments!, keyword, name, nil, line)
53: end
# File lib/gherkin/listener/formatter_listener.rb, line 75
75: def grab_comments!
76: comments = @comments
77: @comments = []
78: comments
79: end
# File lib/gherkin/listener/formatter_listener.rb, line 93
93: def grab_py_string!
94: py_string = @py_string
95: @py_string = nil
96: py_string
97: end
# File lib/gherkin/listener/formatter_listener.rb, line 87
87: def grab_rows!
88: table = @table
89: @table = nil
90: table
91: end
# File lib/gherkin/listener/formatter_listener.rb, line 99
99: def replay_step_or_examples
100: if(@step_statement)
101: @step_statement.multiline_arg = grab_py_string! || grab_rows!
102: @formatter.step(@step_statement)
103: @step_statement = nil
104: end
105: if(@examples_statement)
106: @examples_statement.rows = grab_rows!
107: @formatter.examples(@examples_statement)
108: @examples_statement = nil
109: end
110: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.
# File lib/gherkin/listener/formatter_listener.rb, line 19 19: def comment(value, line) 20: @comments << Formatter::Model::Comment.new(value, line) 21: end