Class: CukeModeler::Directory
- Defined in:
- lib/cuke_modeler/models/directory.rb
Overview
A class modeling a directory in a Cucumber suite.
Instance Attribute Summary collapse
-
#directories ⇒ Object
The directory models contained by the modeled directory.
-
#feature_files ⇒ Object
The feature file models contained by the modeled directory.
-
#path ⇒ Object
The file path of the modeled directory.
Attributes included from Nested
Instance Method Summary collapse
-
#children ⇒ Array<Directory, FeatureFile>
Returns the model objects that are children of this model.
-
#initialize(directory_path = nil) ⇒ Directory
constructor
Creates a new Directory object and, if directory_path is provided, populates the object.
-
#inspect(verbose: false) ⇒ String
See ‘Object#inspect`.
-
#name ⇒ String?
Returns the name of the modeled directory.
-
#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(directory_path = nil) ⇒ Directory
Creates a new Directory object and, if directory_path is provided, populates the object.
28 29 30 31 32 33 34 |
# File 'lib/cuke_modeler/models/directory.rb', line 28 def initialize(directory_path = nil) @path = directory_path @feature_files = [] @directories = [] super(directory_path) end |
Instance Attribute Details
#directories ⇒ Object
The directory models contained by the modeled directory
11 12 13 |
# File 'lib/cuke_modeler/models/directory.rb', line 11 def directories @directories end |
#feature_files ⇒ Object
The feature file models contained by the modeled directory
8 9 10 |
# File 'lib/cuke_modeler/models/directory.rb', line 8 def feature_files @feature_files end |
#path ⇒ Object
The file path of the modeled directory
14 15 16 |
# File 'lib/cuke_modeler/models/directory.rb', line 14 def path @path end |
Instance Method Details
#children ⇒ Array<Directory, FeatureFile>
Returns the model objects that are children of this model. For a Directory model, these would be any associated Directory and FeatureFile models.
55 56 57 |
# File 'lib/cuke_modeler/models/directory.rb', line 55 def children @feature_files + @directories 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 Directory model, this will be the path of the directory. If verbose is true, provides default Ruby inspection behavior instead.
83 84 85 86 87 |
# File 'lib/cuke_modeler/models/directory.rb', line 83 def inspect(verbose: false) return super(verbose: verbose) if verbose "#{super.chop} @path: #{@path.inspect}>" end |
#name ⇒ String?
Returns the name of the modeled directory.
43 44 45 |
# File 'lib/cuke_modeler/models/directory.rb', line 43 def name File.basename(@path.gsub('\\', '/')) if @path end |
#to_s ⇒ String
Returns a string representation of this model. For a Directory model, this will be the path of the modeled directory.
66 67 68 |
# File 'lib/cuke_modeler/models/directory.rb', line 66 def to_s path.to_s end |