Class: Til::NoteWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/til/note_writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title) ⇒ NoteWriter

Returns a new instance of NoteWriter.



5
6
7
# File 'lib/til/note_writer.rb', line 5

def initialize title
  @title = title
end

Instance Attribute Details

#titleObject (readonly)

Returns the value of attribute title.



3
4
5
# File 'lib/til/note_writer.rb', line 3

def title
  @title
end

Instance Method Details

#call(if_modified, if_unmodified) ⇒ Object



9
10
11
12
13
# File 'lib/til/note_writer.rb', line 9

def call(if_modified, if_unmodified)
  temporary_note = TemporaryNote.new
  temporary_note.write("# #{title}\n\n")
  temporary_note.edit(if_modified, if_unmodified)
end