From 423249504a2b468d7a273cbe6accf4f21cb0e643 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 2 Nov 2013 15:40:16 -0700 Subject: Added Numeric#in_milliseconds, like 1.hour.in_milliseconds, so we can feed them to JavaScript functions like getTime(). --- activesupport/lib/active_support/core_ext/numeric/time.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/core_ext/numeric/time.rb b/activesupport/lib/active_support/core_ext/numeric/time.rb index 87b9a23aef..d97ce938c1 100644 --- a/activesupport/lib/active_support/core_ext/numeric/time.rb +++ b/activesupport/lib/active_support/core_ext/numeric/time.rb @@ -76,4 +76,10 @@ class Numeric # Reads best without arguments: 10.minutes.from_now alias :from_now :since + + # Used with the standard time durations, like 1.hour.in_milliseconds -- + # so we can feed them to JavaScript functions like getTime(). + def in_milliseconds + self * 1000 + end end -- cgit v1.2.3