class Noir::Command::Edit::Note

Public Class Methods

edit(target) click to toggle source
# File lib/noir/command/edit/note.rb, line 6
def edit target
  system("#{Noir::Command::Edit.editor} #{target}")
end
edit_before_note(diff) click to toggle source
# File lib/noir/command/edit/note.rb, line 26
def edit_before_note diff
  notes = Dir.glob(Noir::Command::New::Note::FileNameGlob)
  if notes.size > diff.abs.succ
    edit notes.sort_by(&:to_i)[diff-1]
  else
    raise "Cannot find notes before #{diff} count."
  end
end
edit_today_note() click to toggle source
# File lib/noir/command/edit/note.rb, line 19
def edit_today_note
  search_pattern = '*' + Time.now.strftime(Noir::Command::New::Note::TimeFormat) + '*'
  today_files    = Dir.glob(search_pattern)
  target         = today_files.sort.last || Noir::Command::New::Note.create_new_note
  edit target
end
execute(*args) click to toggle source
# File lib/noir/command/edit/note.rb, line 10
def execute *args

  if args.size.zero?
    edit_today_note
  else
    edit_before_note args.first.to_i
  end
end