Class: Date

Inherits:
Object
  • Object
show all
Defined in:
lib/certificate_authority/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#advance(options) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/certificate_authority/core_extensions.rb', line 36

def advance(options)
  options = options.dup
  d = self
  d = d >> options.delete(:years) * 12 if options[:years]
  d = d >> options.delete(:months)     if options[:months]
  d = d +  options.delete(:weeks) * 7  if options[:weeks]
  d = d +  options.delete(:days)       if options[:days]
  d
end

#todayObject



26
27
28
29
# File 'lib/certificate_authority/core_extensions.rb', line 26

def today
  t = Time.now.utc
  Date.new(t.year, t.month, t.day)
end

#utcObject



31
32
33
# File 'lib/certificate_authority/core_extensions.rb', line 31

def utc
  self.to_datetime.to_time.utc
end