Class: NoteFormatter::Formatter

Inherits:
Object
  • Object
show all
Includes:
Helpers::Configuration
Defined in:
lib/note_formatter/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Configuration

#config, #f, #l, #m

Constructor Details

#initialize(format, note) ⇒ Formatter

Returns a new instance of Formatter.



9
10
11
12
# File 'lib/note_formatter/formatter.rb', line 9

def initialize(format, note)
  @format = format
  @note = note
end

Instance Attribute Details

#formatObject

Returns the value of attribute format.



7
8
9
# File 'lib/note_formatter/formatter.rb', line 7

def format
  @format
end

#noteObject

Returns the value of attribute note.



7
8
9
# File 'lib/note_formatter/formatter.rb', line 7

def note
  @note
end

Instance Method Details

#format_fileObject



14
15
16
17
18
19
# 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