Class: Gitdocs::Docdir
Instance Attribute Summary collapse
-
#files ⇒ Object
Returns the value of attribute files.
-
#subdirs ⇒ Object
Returns the value of attribute subdirs.
Attributes inherited from Docfile
#author, #modified, #name, #parent, #path
Instance Method Summary collapse
- #file? ⇒ Boolean
-
#initialize(path) ⇒ Docdir
constructor
A new instance of Docdir.
- #items ⇒ Object
- #parent=(dir) ⇒ Object
Methods inherited from Docfile
Constructor Details
#initialize(path) ⇒ Docdir
Returns a new instance of Docdir.
27 28 29 30 31 |
# File 'lib/gitdocs/docfile.rb', line 27 def initialize(path) super @subdirs = [] @files = [] end |
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
25 26 27 |
# File 'lib/gitdocs/docfile.rb', line 25 def files @files end |
#subdirs ⇒ Object
Returns the value of attribute subdirs.
24 25 26 |
# File 'lib/gitdocs/docfile.rb', line 24 def subdirs @subdirs end |
Instance Method Details
#file? ⇒ Boolean
41 42 43 |
# File 'lib/gitdocs/docfile.rb', line 41 def file? false end |
#items ⇒ Object
33 34 35 |
# File 'lib/gitdocs/docfile.rb', line 33 def items (subdirs + files).sort { |a,b| a.name.downcase <=> b.name.downcase } end |
#parent=(dir) ⇒ Object
37 38 39 |
# File 'lib/gitdocs/docfile.rb', line 37 def parent=(dir) dir.subdirs.push(self) if dir end |