nearest 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nearest.rb +2 -1
- metadata +1 -1
data/lib/nearest.rb
CHANGED
@@ -2,6 +2,7 @@ class Time
|
|
2
2
|
def nearest(seconds, opts={})
|
3
3
|
method = opts[:force] ? (opts[:force] == :future ? 'ceil' : 'floor') : 'round'
|
4
4
|
|
5
|
-
Time.at((self.to_f / seconds).send(method) * seconds)
|
5
|
+
new_time = Time.at((self.to_f / seconds).send(method) * seconds)
|
6
|
+
utc? ? new_time.utc : new_time
|
6
7
|
end
|
7
8
|
end
|