Class: Cukedep::GherkinListener
- Inherits:
-
Object
- Object
- Cukedep::GherkinListener
- Defined in:
- lib/cukedep/gherkin-listener.rb
Overview
A ParserListener listens to all the formatting events emitted by the Gherkin parser. It converts the received the feature file elements and builds a representation of the feature files that is appropriate for the Cukedep application.
Instance Attribute Summary collapse
-
#current_feature ⇒ Object
Internal representation of the feature being parsed.
-
#feature_files ⇒ Object
readonly
The list of feature files encountered so far.
Instance Method Summary collapse
-
#feature_tags(tag_names) ⇒ Object
aFeature is a Gherkin::Formatter::Model::Feature instance.
-
#initialize ⇒ GherkinListener
constructor
Constructor.
-
#method_missing(message, *args) ⇒ Object
Catch all method.
-
#uri(featureURI) ⇒ Object
Called when beginning the parsing of a feature file.
Constructor Details
#initialize ⇒ GherkinListener
Constructor
33 34 35 |
# File 'lib/cukedep/gherkin-listener.rb', line 33 def initialize @feature_files = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(message, *args) ⇒ Object
Catch all method
54 55 56 57 58 |
# File 'lib/cukedep/gherkin-listener.rb', line 54 def method_missing(, *args) puts caller(1, 5).join("\n") puts "Method #{} is not implemented (yet)." super(, args) end |
Instance Attribute Details
#current_feature ⇒ Object
Internal representation of the feature being parsed
30 31 32 |
# File 'lib/cukedep/gherkin-listener.rb', line 30 def current_feature @current_feature end |
#feature_files ⇒ Object (readonly)
The list of feature files encountered so far
27 28 29 |
# File 'lib/cukedep/gherkin-listener.rb', line 27 def feature_files @feature_files end |
Instance Method Details
#feature_tags(tag_names) ⇒ Object
aFeature is a Gherkin::Formatter::Model::Feature instance
49 50 51 |
# File 'lib/cukedep/gherkin-listener.rb', line 49 def (tag_names) @current_feature = feature_files.last.feature = FeatureRep.new(tag_names) end |
#uri(featureURI) ⇒ Object
Called when beginning the parsing of a feature file. featureURI: path + filename of feature file.
43 44 45 46 |
# File 'lib/cukedep/gherkin-listener.rb', line 43 def uri(featureURI) new_file = FeatureFileRep.new(featureURI) feature_files << new_file end |