Class: DayoneToQuiver::API::DayoneJournalToQuiverNotebook
- Inherits:
-
Object
- Object
- DayoneToQuiver::API::DayoneJournalToQuiverNotebook
- Defined in:
- lib/dayone_to_quiver/api.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #exec ⇒ Object
-
#initialize(journal_file, options) ⇒ DayoneJournalToQuiverNotebook
constructor
A new instance of DayoneJournalToQuiverNotebook.
Constructor Details
#initialize(journal_file, options) ⇒ DayoneJournalToQuiverNotebook
Returns a new instance of DayoneJournalToQuiverNotebook.
28 29 30 31 32 33 34 35 36 |
# File 'lib/dayone_to_quiver/api.rb', line 28 def initialize(journal_file, ) @input_file = journal_file @journal = ::DayoneToolbox::Journal.new(journal_file) @notebook = QuiverToolbox::Notebook.new do |n| n.name = [:name] n.store_path = [:output] end @result = '' end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
27 28 29 |
# File 'lib/dayone_to_quiver/api.rb', line 27 def result @result end |
Instance Method Details
#exec ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/dayone_to_quiver/api.rb', line 39 def exec @notebook.store @journal.entries.each do |entry| entry_obj = ::DayoneToQuiver::DayoneEntry.new(entry) note = @notebook.build_note(entry_obj.to_quiver_hash) converter = ::DayoneToQuiver::Converter.new(entry_obj, note) @result << "#{converter.note.file_name_with_path}\n" if converter.store end self end |