Class: CukeModeler::FeatureFile
- Defined in:
- lib/cuke_modeler/models/feature_file.rb
Overview
A class modeling a feature file in a Cucumber suite.
Instance Attribute Summary collapse
-
#feature ⇒ Object
The feature model contained by the modeled feature file.
-
#path ⇒ Object
The file path of the modeled feature file.
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 Nested
Constructor Details
#initialize(file_path = nil) ⇒ FeatureFile
Creates a new FeatureFile object and, if file_path is provided, populates the object.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 17 def initialize(file_path = nil) @path = file_path 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
#feature ⇒ Object
The feature model contained by the modeled feature file
9 10 11 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 9 def feature @feature end |
#path ⇒ Object
The file path of the modeled feature file
12 13 14 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 12 def path @path end |
Instance Method Details
#children ⇒ Object
Returns the model objects that belong to this model.
37 38 39 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 37 def children [@feature] end |
#name ⇒ Object
Returns the name of the modeled feature file.
32 33 34 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 32 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.
43 44 45 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 43 def to_s path.to_s end |