Class: DayoneToQuiver::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/dayone_to_quiver/converter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry, note) ⇒ Converter

Returns a new instance of Converter.



5
6
7
8
9
# File 'lib/dayone_to_quiver/converter.rb', line 5

def initialize(entry, note)
  @entry = entry
  @note = note
  with_photo if @entry.photo?
end

Instance Attribute Details

#entryObject (readonly)

Returns the value of attribute entry.



4
5
6
# File 'lib/dayone_to_quiver/converter.rb', line 4

def entry
  @entry
end

#noteObject (readonly)

Returns the value of attribute note.



4
5
6
# File 'lib/dayone_to_quiver/converter.rb', line 4

def note
  @note
end

Instance Method Details

#storeObject



21
22
23
# File 'lib/dayone_to_quiver/converter.rb', line 21

def store
  @note.store
end

#with_photoObject



12
13
14
15
16
17
18
# File 'lib/dayone_to_quiver/converter.rb', line 12

def with_photo
  @note.src_resources = [@entry.photo]
  image_url = File.basename(@note.resources.first['dist'])
  link_str = "![#{image_url}](quiver-image-url/#{image_url})"
  @note.cells.last['data'] << "\n\n #{link_str}"
  self
end