class WB::Note

Attributes

number[R]
path[R]

Public Class Methods

all() click to toggle source
# File lib/wb/note.rb, line 7
def self.all
  WB.config.notes
end
find_by_basename(basename) click to toggle source
# File lib/wb/note.rb, line 19
def self.find_by_basename(basename)
  all.find { |note| File.basename(note.path) == basename }
end
find_by_full_path(full_path) click to toggle source
# File lib/wb/note.rb, line 15
def self.find_by_full_path(full_path)
  all.find { |note| note.path == full_path }
end
find_by_number(number) click to toggle source
# File lib/wb/note.rb, line 11
def self.find_by_number(number)
  all.find { |note| note.number == number }
end
find_note(name) click to toggle source
# File lib/wb/note.rb, line 23
def self.find_note(name)
  find_by_full_path(name) || find_by_basename(name)
end
list_notes() click to toggle source
# File lib/wb/note.rb, line 27
def self.list_notes
  all.each { |note| $stdout.puts note }
end
new(path, number) click to toggle source
# File lib/wb/note.rb, line 31
def initialize(path, number)
  @path = path
  @number = number.to_s
end

Public Instance Methods

to_s() click to toggle source
# File lib/wb/note.rb, line 36
def to_s
  %Q(#{number}: #{path})
end