Sha256: 552af6b4701adb134fcf2d7368d8fadc79002cd76e59b513d0d62223fcf87bf8
Contents?: true
Size: 898 Bytes
Versions: 1
Compression:
Stored size: 898 Bytes
Contents
module Nin class ItemPresenter < SimpleDelegator def call sprintf("%d\t%s\t%s \t%s %s", id, completed, date, desc, tags).gsub(' ', ' ') end private def desc if self.archived? self.desc.yellow elsif self.completed? self.desc.white else self.desc end end def completed if self.completed? '[x]'.green else '[ ]' end end def date case self.date when Date.today.to_s '@today'.bold when Date.today.succ.to_s '@tomorrow' when Date.today.prev_day.to_s '@yesterday'.magenta else if self.due? ('@' << self.date).magenta else '@' << self.date end end.cyan end def tags self.tags.map { |tag| tag.dup.prepend('#') }.join(' ').blue end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nin-0.7.0 | lib/nin/item_presenter.rb |