mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Explicit dependency on String#start_with? extension
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user