Method: Notes#initialize
- Defined in:
- lib/cnote/notes.rb
#initialize(config) ⇒ Notes
Returns a new instance of Notes.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cnote/notes.rb', line 11 def initialize(config) @config = config @index = 1 @notes = Hash.new notes = Dir[File.join(@config.note_path, "**/*")].select do |f| [".txt", ".md"].include?(File.extname(f)) end notes.each do |path| note = Note.new(path) note.index = @index @notes[@index] = note @index += 1 end @indent = notes.length.to_s.length + 2 set_filtered(@notes) end |