Class: Til::Directory
- Inherits:
-
Object
- Object
- Til::Directory
- Defined in:
- lib/til/models/directory.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(subject = nil) ⇒ Directory
constructor
A new instance of Directory.
- #notes ⇒ Object
Constructor Details
#initialize(subject = nil) ⇒ Directory
Returns a new instance of Directory.
5 6 7 8 9 10 11 |
# File 'lib/til/models/directory.rb', line 5 def initialize(subject=nil) if subject @path = Settings.load.directory + "/#{subject}/*.md" else @path = Settings.load.directory + "/**/*.md" end end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/til/models/directory.rb', line 3 def path @path end |
Class Method Details
.for(subject) ⇒ Object
17 18 19 |
# File 'lib/til/models/directory.rb', line 17 def self.for(subject) self.new(subject) end |
.root ⇒ Object
13 14 15 |
# File 'lib/til/models/directory.rb', line 13 def self.root self.new end |
Instance Method Details
#notes ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/til/models/directory.rb', line 21 def notes note_list = NoteList.new note_paths.each do |note_path| note_list.push Note.new(note_path) end note_list end |