Class: Madman::Directory
- Inherits:
-
Object
- Object
- Madman::Directory
- Defined in:
- lib/madman/directory.rb
Overview
Represents a directory with markdown files and subflders.
Instance Attribute Summary collapse
-
#basedir ⇒ Object
readonly
Returns the value of attribute basedir.
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
Instance Method Summary collapse
- #deep_list ⇒ Object
-
#initialize(dir, basedir = nil) ⇒ Directory
constructor
A new instance of Directory.
- #list ⇒ Object
Constructor Details
#initialize(dir, basedir = nil) ⇒ Directory
Returns a new instance of Directory.
6 7 8 9 |
# File 'lib/madman/directory.rb', line 6 def initialize(dir, basedir = nil) @dir = dir @basedir = basedir || dir end |
Instance Attribute Details
#basedir ⇒ Object (readonly)
Returns the value of attribute basedir.
4 5 6 |
# File 'lib/madman/directory.rb', line 4 def basedir @basedir end |
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
4 5 6 |
# File 'lib/madman/directory.rb', line 4 def dir @dir end |
Instance Method Details
#deep_list ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/madman/directory.rb', line 15 def deep_list result = list dirs.each do |dir| result += Directory.new(dir.path, basedir).deep_list end result end |
#list ⇒ Object
11 12 13 |
# File 'lib/madman/directory.rb', line 11 def list @list ||= (dirs + files) end |