Class: CukeModeler::FeatureFile
- Includes:
- Parsed
- Defined in:
- lib/cuke_modeler/models/feature_file.rb
Overview
A class modeling a feature file in a Cucumber suite.
Instance Attribute Summary collapse
-
#comments ⇒ Object
The comment models contained by the modeled feature file.
-
#feature ⇒ Object
The feature model contained by the modeled feature file.
-
#path ⇒ Object
The file path of the modeled feature file.
Attributes included from Parsed
Attributes included from Nested
Instance Method Summary collapse
-
#children ⇒ Object
Returns the model objects that belong to this model.
-
#initialize(file_path = nil) ⇒ FeatureFile
constructor
Creates a new FeatureFile object and, if file_path is provided, populates the object.
-
#name ⇒ Object
Returns the name of the modeled feature file.
-
#to_s ⇒ Object
Returns a string representation of this model.
Methods included from Containing
Methods included from Nested
Constructor Details
#initialize(file_path = nil) ⇒ FeatureFile
Creates a new FeatureFile object and, if file_path is provided, populates the object.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 22 def initialize(file_path = nil) @path = file_path @comments = [] super(file_path) if file_path raise(ArgumentError, "Unknown file: #{file_path.inspect}") unless File.exists?(file_path) processed_feature_file_data = process_feature_file(file_path) populate_featurefile(self, processed_feature_file_data) end end |
Instance Attribute Details
#comments ⇒ Object
The comment models contained by the modeled feature file
11 12 13 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 11 def comments @comments end |
#feature ⇒ Object
The feature model contained by the modeled feature file
14 15 16 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 14 def feature @feature end |
#path ⇒ Object
The file path of the modeled feature file
17 18 19 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 17 def path @path end |
Instance Method Details
#children ⇒ Object
Returns the model objects that belong to this model.
43 44 45 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 43 def children @feature ? [@feature] : [] end |
#name ⇒ Object
Returns the name of the modeled feature file.
38 39 40 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 38 def name File.basename(@path.gsub('\\', '/')) if @path end |
#to_s ⇒ Object
Returns a string representation of this model. For a feature file model, this will be the path of the modeled feature file.
49 50 51 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 49 def to_s path.to_s end |