aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/json/decoding.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-03-28 23:51:20 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-03-28 23:51:20 -0700
commitd41387fde7fca23316d913b2628e2b85f58a85a5 (patch)
tree42529c51741de4920d1f5879ec45f24c80902cd9 /activesupport/lib/active_support/json/decoding.rb
parent4d464552443b8b3e906f7e231602ac0f362758ed (diff)
downloadrails-d41387fde7fca23316d913b2628e2b85f58a85a5.tar.gz
rails-d41387fde7fca23316d913b2628e2b85f58a85a5.tar.bz2
rails-d41387fde7fca23316d913b2628e2b85f58a85a5.zip
Explicit dependency on String#start_with? extension
Diffstat (limited to 'activesupport/lib/active_support/json/decoding.rb')
-rw-r--r--activesupport/lib/active_support/json/decoding.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb
index 0e079341ff..b0a9d935ba 100644
--- a/activesupport/lib/active_support/json/decoding.rb
+++ b/activesupport/lib/active_support/json/decoding.rb
@@ -1,6 +1,8 @@
require 'yaml'
require 'strscan'
+require 'active_support/core_ext/string/starts_ends_with'
+
module ActiveSupport
module JSON
class ParseError < StandardError
@@ -45,7 +47,7 @@ module ActiveSupport
if marks.empty?
json.gsub(/\\([\\\/]|u[[:xdigit:]]{4})/) do
ustr = $1
- if ustr.starts_with?('u')
+ if ustr.start_with?('u')
[ustr[1..-1].to_i(16)].pack("U")
elsif ustr == '\\'
'\\\\'
@@ -61,10 +63,10 @@ module ActiveSupport
scanner.pos = left.succ
output << scanner.peek(right_pos[i] - scanner.pos + 1).gsub(/\\([\\\/]|u[[:xdigit:]]{4})/) do
ustr = $1
- if ustr.starts_with?('u')
+ if ustr.start_with?('u')
[ustr[1..-1].to_i(16)].pack("U")
elsif ustr == '\\'
- '\\\\'
+ '\\\\'
else
ustr
end