Class: CucumberAnalytics::Directory
- Inherits:
-
Object
- Object
- CucumberAnalytics::Directory
- Includes:
- Containing, Nested
- Defined in:
- lib/cucumber_analytics/directory.rb
Overview
A class modeling a directory containing .feature files.
Instance Attribute Summary collapse
-
#directories ⇒ Object
The Directory objects contained by the Directory.
-
#feature_files ⇒ Object
The FeatureFile objects contained by the Directory.
Attributes included from Nested
Instance Method Summary collapse
-
#contains ⇒ Object
Returns the immediate child elements of the directory (i.e. its Directory and FeatureFile objects).
-
#directory_count ⇒ Object
Returns the number of sub-directories contained in the directory.
-
#feature_file_count ⇒ Object
Returns the number of features files contained in the directory.
-
#initialize(directory_parsed = nil) ⇒ Directory
constructor
Creates a new Directory object and, if directory_parsed is provided, populates the object.
-
#name ⇒ Object
Returns the name of the directory.
-
#path ⇒ Object
Returns the path of the directory.
-
#to_s ⇒ Object
Returns the path of the directory.
Methods included from Nested
Constructor Details
#initialize(directory_parsed = nil) ⇒ Directory
Creates a new Directory object and, if directory_parsed is provided, populates the object.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cucumber_analytics/directory.rb', line 20 def initialize(directory_parsed = nil) @directory = directory_parsed @feature_files = [] @directories = [] if directory_parsed raise(ArgumentError, "Unknown directory: #{directory_parsed.inspect}") unless File.exists?(directory_parsed) build_directory end end |
Instance Attribute Details
#directories ⇒ Object
The Directory objects contained by the Directory
15 16 17 |
# File 'lib/cucumber_analytics/directory.rb', line 15 def directories @directories end |
#feature_files ⇒ Object
The FeatureFile objects contained by the Directory
12 13 14 |
# File 'lib/cucumber_analytics/directory.rb', line 12 def feature_files @feature_files end |
Instance Method Details
#contains ⇒ Object
Returns the immediate child elements of the directory (i.e. its Directory and FeatureFile objects).
54 55 56 |
# File 'lib/cucumber_analytics/directory.rb', line 54 def contains @feature_files + @directories end |
#directory_count ⇒ Object
Returns the number of sub-directories contained in the directory.
43 44 45 |
# File 'lib/cucumber_analytics/directory.rb', line 43 def directory_count @directories.count end |
#feature_file_count ⇒ Object
Returns the number of features files contained in the directory.
48 49 50 |
# File 'lib/cucumber_analytics/directory.rb', line 48 def feature_file_count @feature_files.count end |
#name ⇒ Object
Returns the name of the directory.
33 34 35 |
# File 'lib/cucumber_analytics/directory.rb', line 33 def name File.basename(@directory.gsub('\\', '/')) end |
#path ⇒ Object
Returns the path of the directory.
38 39 40 |
# File 'lib/cucumber_analytics/directory.rb', line 38 def path @directory end |
#to_s ⇒ Object
Returns the path of the directory.
59 60 61 |
# File 'lib/cucumber_analytics/directory.rb', line 59 def to_s path.to_s end |