aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/duration
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/duration')
-rw-r--r--activesupport/lib/active_support/duration/iso8601_parser.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/duration/iso8601_parser.rb b/activesupport/lib/active_support/duration/iso8601_parser.rb
index 07af58ad99..12515633fc 100644
--- a/activesupport/lib/active_support/duration/iso8601_parser.rb
+++ b/activesupport/lib/active_support/duration/iso8601_parser.rb
@@ -1,4 +1,5 @@
require 'strscan'
+require 'active_support/core_ext/regexp'
module ActiveSupport
class Duration
@@ -85,7 +86,7 @@ module ActiveSupport
# Parses number which can be a float with either comma or period.
def number
- scanner[1] =~ PERIOD_OR_COMMA ? scanner[1].tr(COMMA, PERIOD).to_f : scanner[1].to_i
+ PERIOD_OR_COMMA.match?(scanner[1]) ? scanner[1].tr(COMMA, PERIOD).to_f : scanner[1].to_i
end
def scan(pattern)