Class: YARD::Parser::Cucumber::FeatureParser
- Inherits:
-
Base
- Object
- Base
- YARD::Parser::Cucumber::FeatureParser
- Defined in:
- lib/yard/parser/cucumber/feature.rb
Instance Method Summary collapse
- #enumerator ⇒ Object
-
#initialize(source, file = '(stdin)') ⇒ FeatureParser
constructor
A new instance of FeatureParser.
- #parse ⇒ Object
- #tokenize ⇒ Object
Constructor Details
#initialize(source, file = '(stdin)') ⇒ FeatureParser
Returns a new instance of FeatureParser.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/yard/parser/cucumber/feature.rb', line 5 def initialize(source, file = '(stdin)') @builder = Cucumber::Parser::CityBuilder.new(file) @tag_counts = {} @tag_formatter = Gherkin::Formatter::TagCountFormatter.new(@builder, @tag_counts) @parser = Gherkin::Parser::Parser.new(@tag_formatter, true, "root", false) @source = source @file = file @feature = nil end |
Instance Method Details
#enumerator ⇒ Object
37 38 39 |
# File 'lib/yard/parser/cucumber/feature.rb', line 37 def enumerator [@feature] end |
#parse ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/yard/parser/cucumber/feature.rb', line 18 def parse begin @parser.parse(@source, @file, 0) @feature = @builder.ast return nil if @feature.nil? # Nothing matched @feature.language = @parser.i18n_language rescue Gherkin::Lexer::LexingError, Gherkin::Parser::ParseError => e e..insert(0, "#{@file}: ") raise e end self end |
#tokenize ⇒ Object
32 33 34 |
# File 'lib/yard/parser/cucumber/feature.rb', line 32 def tokenize end |