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 ⇒ Object
Returns the model objects that belong to this model.
-
#initialize(directory_path = nil) ⇒ Directory
constructor
Creates a new Directory object and, if directory_path is provided, populates the object.
-
#name ⇒ Object
Returns the name of the modeled directory.
-
#to_s ⇒ Object
Returns a string representation of this 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.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cuke_modeler/models/directory.rb', line 20 def initialize(directory_path = nil) @path = directory_path @feature_files = [] @directories = [] super(directory_path) if directory_path raise(ArgumentError, "Unknown directory: #{directory_path.inspect}") unless File.exists?(directory_path) processed_directory_data = process_directory(directory_path) populate_directory(self, processed_directory_data) end end |
Instance Attribute Details
#directories ⇒ Object
The directory models contained by the modeled directory
12 13 14 |
# File 'lib/cuke_modeler/models/directory.rb', line 12 def directories @directories end |
#feature_files ⇒ Object
The feature file models contained by the modeled directory
9 10 11 |
# File 'lib/cuke_modeler/models/directory.rb', line 9 def feature_files @feature_files end |
#path ⇒ Object
The file path of the modeled directory
15 16 17 |
# File 'lib/cuke_modeler/models/directory.rb', line 15 def path @path end |
Instance Method Details
#children ⇒ Object
Returns the model objects that belong to this model.
41 42 43 |
# File 'lib/cuke_modeler/models/directory.rb', line 41 def children @feature_files + @directories end |
#name ⇒ Object
Returns the name of the modeled directory.
36 37 38 |
# File 'lib/cuke_modeler/models/directory.rb', line 36 def name File.basename(@path.gsub('\\', '/')) if @path end |
#to_s ⇒ Object
Returns a string representation of this model. For a directory model, this will be the path of the modeled directory.
47 48 49 |
# File 'lib/cuke_modeler/models/directory.rb', line 47 def to_s path.to_s end |