class DayoneToQuiver::DayoneEntry

Public Class Methods

to_quiver_title(entry_text) click to toggle source
# File lib/dayone_to_quiver/dayone_entry.rb, line 11
def self.to_quiver_title(entry_text)
  entry_text.each_line {|l| return l.chomp }
end
to_quiver_unixtime(time) click to toggle source
# File lib/dayone_to_quiver/dayone_entry.rb, line 16
def self.to_quiver_unixtime(time)
  Time.parse("#{time}").to_i
end
to_quiver_uuid(entry_uuid) click to toggle source
# File lib/dayone_to_quiver/dayone_entry.rb, line 4
def self.to_quiver_uuid(entry_uuid)
  new_uuid = entry_uuid.dup
  new_uuid.insert(-25, '-').insert(-21, '-').insert(-17, '-').insert(-13, '-')
  new_uuid
end

Public Instance Methods

q_cells(type='markdown') click to toggle source
# File lib/dayone_to_quiver/dayone_entry.rb, line 46
def q_cells(type='markdown')
  [{
    'type' => type,
    'data' => entry_text
  }]
end
q_created_at() click to toggle source
# File lib/dayone_to_quiver/dayone_entry.rb, line 36
def q_created_at
  self.class.to_quiver_unixtime(creation_date)
end
q_tags() click to toggle source
# File lib/dayone_to_quiver/dayone_entry.rb, line 21
def q_tags
  tags
end
q_title() click to toggle source
# File lib/dayone_to_quiver/dayone_entry.rb, line 26
def q_title
  self.class.to_quiver_title(entry_text)
end
q_updated_at() click to toggle source
# File lib/dayone_to_quiver/dayone_entry.rb, line 41
def q_updated_at
  q_created_at
end
q_uuid() click to toggle source
# File lib/dayone_to_quiver/dayone_entry.rb, line 31
def q_uuid
  self.class.to_quiver_uuid(uuid)
end
to_quiver_hash() click to toggle source
# File lib/dayone_to_quiver/dayone_entry.rb, line 54
def to_quiver_hash
  {
    ::QuiverToolbox::Note::KEY_CREATED_AT => q_created_at,
    ::QuiverToolbox::Note::KEY_TAGS => q_tags,
    ::QuiverToolbox::Note::KEY_TITLE => q_title,
    ::QuiverToolbox::Note::KEY_UPDATED_AT => q_updated_at,
    ::QuiverToolbox::Note::KEY_UUID => q_uuid,
    ::QuiverToolbox::Note::KEY_CELLS => q_cells
  }
end