Class: Cucumber::Gherkin::StepsParser
- Inherits:
-
Object
- Object
- Cucumber::Gherkin::StepsParser
- Defined in:
- lib/cucumber/gherkin/steps_parser.rb
Instance Method Summary collapse
- #feature_header(dialect) ⇒ Object
- #gherkin_options ⇒ Object
-
#initialize(builder, language) ⇒ StepsParser
constructor
A new instance of StepsParser.
- #parse(text) ⇒ Object
Constructor Details
#initialize(builder, language) ⇒ StepsParser
Returns a new instance of StepsParser.
9 10 11 12 |
# File 'lib/cucumber/gherkin/steps_parser.rb', line 9 def initialize(builder, language) @builder = builder @language = language end |
Instance Method Details
#feature_header(dialect) ⇒ Object
35 36 37 38 39 |
# File 'lib/cucumber/gherkin/steps_parser.rb', line 35 def feature_header(dialect) %(#{dialect.feature_keywords[0]}: #{dialect.scenario_keywords[0]}: ) end |
#gherkin_options ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/cucumber/gherkin/steps_parser.rb', line 26 def { default_dialect: @language, include_source: false, include_gherkin_document: true, include_pickles: false } end |
#parse(text) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cucumber/gherkin/steps_parser.rb', line 14 def parse(text) dialect = ::Gherkin::Dialect.for(@language) gherkin_document = nil = ::Gherkin.from_source('dummy', feature_header(dialect) + text, ) .each do || gherkin_document = .gherkin_document.to_h unless .gherkin_document.nil? end @builder.steps(gherkin_document[:feature][:children][0][:scenario][:steps]) end |