class Yinx::NoteMeta

Attributes

batches[RW]
dump_at[RW]
dump_id[RW]

Public Instance Methods

changed_tags?() click to toggle source
# File lib/yinx_st/note_meta.rb, line 37
def changed_tags?
  prev_version and prev_version.tags.sort != self.tags.sort
end
created_today?() click to toggle source
# File lib/yinx_st/note_meta.rb, line 14
def created_today?
  created_at.between? (dump_at - 1.day), dump_at
end
deleted_today?() click to toggle source
# File lib/yinx_st/note_meta.rb, line 18
def deleted_today?
  batches.of_guid(guid).first == self and dump_id != batches.latest_id
end
dump_day() click to toggle source
# File lib/yinx_st/note_meta.rb, line 6
def dump_day
  dump_at.strftime '%y/%m/%d %a'
end
moved_book?() click to toggle source
# File lib/yinx_st/note_meta.rb, line 33
def moved_book?
  prev_version and (prev_version.book != self.book or prev_version.stack != self.stack)
end
prev_version() click to toggle source
# File lib/yinx_st/note_meta.rb, line 29
def prev_version
  @prev_version ||= batches.of_guid(guid).bsearch{|version| version.dump_id < self.dump_id}
end
stack_book() click to toggle source
# File lib/yinx_st/note_meta.rb, line 41
def stack_book
  st = stack.nil? ? '' : "#{stack}/"
  "#{st}#{book}"
end
stack_name() click to toggle source
# File lib/yinx_st/note_meta.rb, line 46
def stack_name
  stack ? stack : 'No Stack'
end
status() click to toggle source
# File lib/yinx_st/note_meta.rb, line 22
def status
  return :created if created_today?
  return :updated if updated_today?
  return :deleted if deleted_today?
  :remained
end
tags_count() click to toggle source
# File lib/yinx_st/note_meta.rb, line 50
def tags_count
  tags.count
end
updated_today?() click to toggle source
# File lib/yinx_st/note_meta.rb, line 10
def updated_today?
  updated_at.between? (dump_at - 1.day), dump_at
end