Class: Vita::Note

Inherits:
Object
  • Object
show all
Defined in:
lib/vita/note.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Note

Returns a new instance of Note.



5
6
7
# File 'lib/vita/note.rb', line 5

def initialize(filename)
  @filename = filename
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



3
4
5
# File 'lib/vita/note.rb', line 3

def filename
  @filename
end

Instance Method Details

#contentObject



13
14
15
# File 'lib/vita/note.rb', line 13

def content
  @content ||= File.read(@filename)
end

#titleObject



9
10
11
# File 'lib/vita/note.rb', line 9

def title
  File.basename(@filename, File.extname(@filename))
end