56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/xmltv/xmltv.rb', line 56
def self.dutch(instring)
nu = today
defjaar, defmaand, defdag, weekdag = nu.year, nu.month, nu.day, nu.wday
jaar = maand = dag = nil
string = instring.gsub(/[[:cntrl:][:punct:]]/, '').downcase
string.split.each do |elem|
case elem
when /[[:alpha:]]+/
if Maanden.include?(elem)
maand = Maanden.index(elem)
if maand < nu.month
defjaar += 1
end
elsif Dagen.include?(elem)
wd = Dagen.index(elem) - weekdag
wd += 7 if wd < 0
nu += wd
defjaar, defmaand, defdag, weekdag = nu.year, nu.month, nu.day, nu.wday
end
when /[[:digit:]]+/
ent = elem.to_i
if ent <= 31
dag = ent
elsif ent > 1900
jaar = ent
end
end
end
new(jaar || defjaar, maand || defmaand,dag || defdag)
end
|