lib/core/facets/time/set.rb in facets-2.8.4 vs lib/core/facets/time/set.rb in facets-2.9.0.pre.1
- old
+ new
@@ -1,14 +1,20 @@
class Time
# Like change but does not reset earlier times.
#
# NOTE: It would be better, probably if this were called "change".
- # and that #change were called "reset".
+ # and that #change were called "reset".
#
def set(options)
- opts={}; options.each_pair{ |k,v| opts[k] = v.to_i }
- self.class.send( self.utc? ? :utc : :local,
+ opts={}
+ options.each_pair do |k,v|
+ k = :min if k.to_s =~ /^min/
+ k = :sec if k.to_s =~ /^sec/
+ opts[k] = v.to_i
+ end
+ self.class.send(
+ self.utc? ? :utc : :local,
opts[:year] || self.year,
opts[:month] || self.month,
opts[:day] || self.day,
opts[:hour] || self.hour,
opts[:min] || self.min,