Class: Yage::Diff

Inherits:
Object
  • Object
show all
Defined in:
lib/yage/diff.rb

Instance Method Summary collapse

Constructor Details

#initialize(date = Date.today) ⇒ Diff

Returns a new instance of Diff.



3
4
5
# File 'lib/yage/diff.rb', line 3

def initialize(date = Date.today)
  @base = date
end

Instance Method Details

#diff(d2 = Date.today) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/yage/diff.rb', line 7

def diff(d2 = Date.today)
  return if d2 < @base

  Data.new(@base,
           d2,
           diff_year(d2),
           diff_month(d2),
           diff_mday(d2),
           diff_yday(d2))
end