class NoteFormatter::Formatter
Attributes
format[RW]
note[RW]
Public Class Methods
new(format, note)
click to toggle source
# File lib/note_formatter/formatter.rb, line 9 def initialize(format, note) @format = format @note = note end
Public Instance Methods
format_file()
click to toggle source
# File lib/note_formatter/formatter.rb, line 14 def format_file file = File.new("./#{note.date}.txt", "w") header file body file file.close end
Private Instance Methods
body(file)
click to toggle source
# File lib/note_formatter/formatter.rb, line 30 def body(file) file.puts("#{l 'tasks'}\n\n") note.tasks.each { |key, value| file.puts("#{m value} #{key}") } end
header(file)
click to toggle source
# File lib/note_formatter/formatter.rb, line 23 def header(file) file.puts("#{l 'date_time'} #{note.date} #{f 'time', format}\n\n") file.puts("#{l 'location'} #{f 'location', format}\n\n") file.puts("#{l 'duration'} #{f 'duration', format}\n\n") file.puts("#{l 'attendees'} #{f 'attendees', format}\n\n\n") end