lib/rufus/scheduler/otime.rb in rufus-scheduler-1.0.13 vs lib/rufus/scheduler/otime.rb in rufus-scheduler-1.0.14
- old
+ new
@@ -1,6 +1,5 @@
-#
#--
# Copyright (c) 2005-2009, John Mettraux, jmettraux@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -17,18 +16,14 @@
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-#++
#
+# Hecho en Costa Rica.
+#++
-#
-# "hecho en Costa Rica"
-#
-# john.mettraux@openwfe.org
-#
require 'date'
#require 'parsedate'
@@ -78,13 +73,13 @@
end
#
# Returns a Ruby time
#
- def Rufus.to_ruby_time (iso_date)
+ def Rufus.to_ruby_time (sdate)
- DateTime.parse(iso_date)
+ DateTime.parse(sdate)
end
#def Rufus.parse_date (date)
#end
@@ -160,22 +155,22 @@
class << self
alias_method :parse_duration_string, :parse_time_string
end
- #
+ #--
# Returns true if the character c is a digit
#
# (probably better served by a regex)
#
- def Rufus.is_digit? (c)
+ #def Rufus.is_digit? (c)
+ # return false if not c.kind_of?(String)
+ # return false if c.length > 1
+ # (c >= '0' and c <= '9')
+ #end
+ #++
- return false if not c.kind_of?(String)
- return false if c.length > 1
- (c >= '0' and c <= '9')
- end
-
#
# conversion methods between Date[Time] and Time
#
# Ruby Cookbook 1st edition p.111
@@ -350,26 +345,26 @@
Float(s.to_s)
end
protected
- DURATIONS2M = [
- [ 'y', 365 * 24 * 3600 ],
- [ 'M', 30 * 24 * 3600 ],
- [ 'w', 7 * 24 * 3600 ],
- [ 'd', 24 * 3600 ],
- [ 'h', 3600 ],
- [ 'm', 60 ],
- [ 's', 1 ]
- ]
- DURATIONS2 = DURATIONS2M.dup
- DURATIONS2.delete_at(1)
+ DURATIONS2M = [
+ [ 'y', 365 * 24 * 3600 ],
+ [ 'M', 30 * 24 * 3600 ],
+ [ 'w', 7 * 24 * 3600 ],
+ [ 'd', 24 * 3600 ],
+ [ 'h', 3600 ],
+ [ 'm', 60 ],
+ [ 's', 1 ]
+ ]
+ DURATIONS2 = DURATIONS2M.dup
+ DURATIONS2.delete_at(1)
- DURATIONS = DURATIONS2M.inject({}) do |r, (k, v)|
- r[k] = v
- r
- end
+ DURATIONS = DURATIONS2M.inject({}) do |r, (k, v)|
+ r[k] = v
+ r
+ end
- DU_KEYS = DURATIONS2M.collect { |k, v| k.to_sym }
+ DU_KEYS = DURATIONS2M.collect { |k, v| k.to_sym }
end