Class: CodeMetrics::StatsDirectories::StatDirectory
- Inherits:
-
Struct
- Object
- Struct
- CodeMetrics::StatsDirectories::StatDirectory
- Defined in:
- lib/code_metrics/stats_directories.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
5 6 7 |
# File 'lib/code_metrics/stats_directories.rb', line 5 def description @description end |
#path ⇒ Object
Returns the value of attribute path
5 6 7 |
# File 'lib/code_metrics/stats_directories.rb', line 5 def path @path end |
Class Method Details
.from_list(list, path_prefix = '') ⇒ Object
18 19 20 21 22 |
# File 'lib/code_metrics/stats_directories.rb', line 18 def self.from_list(list, path_prefix='') list.map do |description, path| new(description, [path_prefix,path].compact.join('/')) end.select(&:directory?) end |
Instance Method Details
#directory? ⇒ Boolean
12 13 14 |
# File 'lib/code_metrics/stats_directories.rb', line 12 def directory? File.directory?(path) end |
#inspect ⇒ Object
9 10 11 |
# File 'lib/code_metrics/stats_directories.rb', line 9 def inspect to_a.inspect end |
#name(file_pattern) ⇒ Object
15 16 17 |
# File 'lib/code_metrics/stats_directories.rb', line 15 def name(file_pattern) path.sub(/^\.\/(#{file_pattern}\/\w+)\/.*/, '\\1') end |
#to_a ⇒ Object
6 7 8 |
# File 'lib/code_metrics/stats_directories.rb', line 6 def to_a [description, path] end |