class Date

Public Class Methods

parse_or_return(unparsed_date) click to toggle source
# File lib/nin/extensions/date_extensions.rb, line 2
def self.parse_or_return(unparsed_date)
  return unparsed_date unless unparsed_date.is_a?(String)

  Date.parse(unparsed_date)
end

Public Instance Methods

humanize() click to toggle source
# File lib/nin/extensions/date_extensions.rb, line 8
def humanize
  case self
  when Date.today.prev_day
    'yesterday'
  when Date.today
    'today'
  when Date.today.succ
    'tomorrow'
  else
    self.to_s
  end
end