Class: Yuzu::Generators::GeneratedFolder
- Includes:
- Helpers
- Defined in:
- lib/yuzu/generators/category_folders.rb
Instance Method Summary collapse
- #all_files ⇒ Object
- #children ⇒ Object
- #files ⇒ Object
- #folders ⇒ Object
-
#initialize(path, parent, children = []) ⇒ GeneratedFolder
constructor
A new instance of GeneratedFolder.
- #to_s ⇒ Object
Constructor Details
#initialize(path, parent, children = []) ⇒ GeneratedFolder
Returns a new instance of GeneratedFolder.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/yuzu/generators/category_folders.rb', line 58 def initialize(path, parent, children=[]) raise ArgumentError, "Not a Path object." if not path.is_a?(Path) @path = path raise "@path is nil for #{self}" if @path.nil? @parent = parent @children = children @kind = :folder end |
Instance Method Details
#all_files ⇒ Object
85 86 87 |
# File 'lib/yuzu/generators/category_folders.rb', line 85 def all_files files end |
#children ⇒ Object
73 74 75 |
# File 'lib/yuzu/generators/category_folders.rb', line 73 def children @children.nil? ? [] : @children end |
#files ⇒ Object
77 78 79 |
# File 'lib/yuzu/generators/category_folders.rb', line 77 def files @children.select {|c| c.file?} end |
#folders ⇒ Object
81 82 83 |
# File 'lib/yuzu/generators/category_folders.rb', line 81 def folders @children.select {|c| c.folder?} end |
#to_s ⇒ Object
69 70 71 |
# File 'lib/yuzu/generators/category_folders.rb', line 69 def to_s "GeneratedFolder(#{@path})" end |