module Gyunyu::Command::Export::CustomFilter
Constants
- LAST_SECOND
- START_SECOND
Public Class Methods
filter()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 13 def filter filter = {} %w( yesterday today tomorrow last_week this_week next_week last_month this_month next_month ).each { |term| due = [ "dueAfter:" + send("from_#{term}"), "dueBefore:" + send("until_#{term}") ].join( ' and ' ) filter[term] = due filter["#{term}_yet"] = due + incomplete } filter end
from_last_month()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 115 def from_last_month d = today << 2 Date.new( d.year, d.mon, -1 ).to_s + START_SECOND end
from_last_week()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 79 def from_last_week if today.sunday? (last_sunday - 1).to_s + START_SECOND else (last_sunday - 8).to_s + START_SECOND end end
from_next_month()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 135 def from_next_month d = today Date.new( d.year, d.mon, -1 ).to_s + START_SECOND end
from_next_week()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 107 def from_next_week (next_sunday - 1).to_s + START_SECOND end
from_this_month()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 125 def from_this_month d = today << 1 Date.new( d.year, d.mon, -1 ).to_s + START_SECOND end
from_this_week()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 95 def from_this_week if today.sunday? (today - 1).to_s + START_SECOND else (last_sunday - 1).to_s + START_SECOND end end
from_today()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 63 def from_today (today - 1).to_s + START_SECOND end
from_tomorrow()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 71 def from_tomorrow today.to_s + START_SECOND end
from_yesterday()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 55 def from_yesterday (today - 2).to_s + START_SECOND end
incomplete()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 145 def incomplete ' and status:incomplete' end
last_sunday()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 29 def last_sunday if today.sunday? today - 7 else proc { |d| until d.sunday? d -= 1 end d }.call(today) end end
next_sunday()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 42 def next_sunday if today.sunday? today + 7 else proc { |d| until d.sunday? d += 1 end d }.call(today) end end
today()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 9 def today Date.today end
until_last_month()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 120 def until_last_month d = today << 1 Date.new( d.year, d.mon, -1 ).to_s + LAST_SECOND end
until_last_week()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 87 def until_last_week if today.sunday? (today - 1).to_s + LAST_SECOND else (last_sunday - 1).to_s + LAST_SECOND end end
until_next_month()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 140 def until_next_month d = today >> 1 Date.new( d.year, d.mon, -1 ).to_s + LAST_SECOND end
until_next_week()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 111 def until_next_week (next_sunday + 6).to_s + LAST_SECOND end
until_this_month()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 130 def until_this_month d = today Date.new( d.year, d.mon, -1 ).to_s + LAST_SECOND end
until_this_week()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 103 def until_this_week (next_sunday - 1).to_s + LAST_SECOND end
until_today()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 67 def until_today today.to_s + LAST_SECOND end
until_tomorrow()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 75 def until_tomorrow (today + 1).to_s + LAST_SECOND end
until_yesterday()
click to toggle source
# File lib/gyunyu/command/export/custom_filter.rb, line 59 def until_yesterday (today - 1).to_s + LAST_SECOND end