class Date
We want a simple time-print class Time
def to_s day.to_s + '/' + month.to_s end def to_ss to_s + '/' + year.to_s end
end
Public Class Methods
from_s(s)
click to toggle source
# File lib/africompta/acqooxview.rb, line 32 def Date.from_s(s) # Do some date-magic, so that we can give either the day, day and month or # a complete date. The rest is filled up with todays date. date = [] if s.index('/') date = s.split('/') else date = s.split('-').reverse end da = Date.today d = [da.day, da.month, da.year] date += d.last(3 - date.size) if date[2].to_s.size > 2 date = Date.strptime(date.join('/'), '%d/%m/%Y') else date = Date.strptime(date.join('/'), '%d/%m/%y') end return date end
Public Instance Methods
month_s()
click to toggle source
# File lib/africompta/acqooxview.rb, line 19 def month_s %w(janvier février mars avril mai juin juillet août septembre octobre novembre décembre)[month-1] end
to_s_eu()
click to toggle source
# File lib/africompta/acqooxview.rb, line 24 def to_s_eu strftime('%d/%m/%y') end
to_s_euy()
click to toggle source
# File lib/africompta/acqooxview.rb, line 28 def to_s_euy strftime('%d/%m/%Y') end