Class: Til::Directory
- Inherits:
-
Object
- Object
- Til::Directory
- Defined in:
- lib/til/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.
7 8 9 10 11 12 13 |
# File 'lib/til/directory.rb', line 7 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.
5 6 7 |
# File 'lib/til/directory.rb', line 5 def path @path end |
Class Method Details
.for(subject) ⇒ Object
19 20 21 |
# File 'lib/til/directory.rb', line 19 def self.for(subject) self.new(subject) end |
.root ⇒ Object
15 16 17 |
# File 'lib/til/directory.rb', line 15 def self.root self.new end |
Instance Method Details
#notes ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/til/directory.rb', line 23 def notes note_list = NoteList.new note_paths.each do |note_path| note_list.push Note.new(note_path) end note_list end |