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 ⇒ Array<Feature>
Returns the model objects that are children of this model.
-
#initialize(file_path = nil) ⇒ FeatureFile
constructor
Creates a new FeatureFile object and, if file_path is provided, populates the object.
-
#inspect(verbose: false) ⇒ String
See ‘Object#inspect`.
-
#name ⇒ String
Returns the name of the modeled feature file.
-
#to_s ⇒ String
Returns a string representation of this model.
Methods included from Containing
#each, #each_descendant, #each_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.
30 31 32 33 34 35 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 30 def initialize(file_path = nil) @path = file_path @comments = [] super end |
Instance Attribute Details
#comments ⇒ Object
The comment models contained by the modeled feature file
10 11 12 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 10 def comments @comments end |
#feature ⇒ Object
The feature model contained by the modeled feature file
13 14 15 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 13 def feature @feature end |
#path ⇒ Object
The file path of the modeled feature file
16 17 18 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 16 def path @path end |
Instance Method Details
#children ⇒ Array<Feature>
Returns the model objects that are children of this model. For a FeatureFile model, this would be any associated Feature model.
55 56 57 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 55 def children @feature ? [@feature] : [] end |
#inspect(verbose: false) ⇒ String
See ‘Object#inspect`. Returns some basic information about the object, including its class, object ID, and its most meaningful attribute. For a FeatureFile model, this will be the path of the feature file. If verbose is true, provides default Ruby inspection behavior instead.
83 84 85 86 87 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 83 def inspect(verbose: false) return super if verbose "#{super.chop} @path: #{@path.inspect}>" end |
#name ⇒ String
Returns the name of the modeled feature file.
44 45 46 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 44 def name File.basename(@path.gsub('\\', '/')) if @path end |
#to_s ⇒ String
Returns a string representation of this model. For a FeatureFile model, this will be the path of the modeled feature file.
66 67 68 |
# File 'lib/cuke_modeler/models/feature_file.rb', line 66 def to_s path.to_s end |