Class: Yuzu::Generators::GeneratedFolder

Inherits:
WebsiteFolder
  • Object
show all
Includes:
Helpers
Defined in:
lib/yuzu/generators/category_folders.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, parent, children = []) ⇒ GeneratedFolder

Returns a new instance of GeneratedFolder.

Raises:

  • (ArgumentError)


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_filesObject



85
86
87
# File 'lib/yuzu/generators/category_folders.rb', line 85

def all_files
  files
end

#childrenObject



73
74
75
# File 'lib/yuzu/generators/category_folders.rb', line 73

def children
  @children.nil? ? [] : @children
end

#filesObject



77
78
79
# File 'lib/yuzu/generators/category_folders.rb', line 77

def files
  @children.select {|c| c.file?}
end

#foldersObject



81
82
83
# File 'lib/yuzu/generators/category_folders.rb', line 81

def folders
  @children.select {|c| c.folder?}
end

#to_sObject



69
70
71
# File 'lib/yuzu/generators/category_folders.rb', line 69

def to_s
  "GeneratedFolder(#{@path})"
end