Class: EverExp::Notes

Inherits:
Array
  • Object
show all
Defined in:
lib/ever_exp/notes.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ Notes

Returns a new instance of Notes.



8
9
10
11
12
# File 'lib/ever_exp/notes.rb', line 8

def initialize dir
  group_into_notes files_in dir
  super notes_hash.values
  remove_instance_variable :@notes_hash
end

Instance Method Details

#group_by_tagObject



14
15
16
17
18
19
20
21
22
# File 'lib/ever_exp/notes.rb', line 14

def group_by_tag
  tag_groups = Hash.new { |hash, tag| hash[tag] = [] }
  each do |note|
    note.tag_array.each do |tag|
      tag_groups[tag] << note
    end
  end
  tag_groups
end