Skip to content

Commit f024f3a

Browse files
jscheidgkellogg
authored andcommitted
Compatibility with ActiveSupport
Closes #2
1 parent 7098e84 commit f024f3a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ group :development, :test do
66
gem 'simplecov-lcov', '~> 0.8', platforms: :mri
77
gem 'benchmark-ips'
88
gem 'rake'
9+
gem 'activesupport'
910
end
1011

1112
group :debug do

lib/json/canonicalization.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Object
1515
# Default canonicalization output for Ruby objects
1616
# @return [String]
1717
def to_json_c14n
18-
self.to_json
18+
::JSON.generate(self)
1919
end
2020
end
2121

@@ -86,15 +86,14 @@ class String
8686
# Output JSON with control characters escaped
8787
# @return [String]
8888
def to_json_c14n
89-
self.to_json
89+
::JSON.generate(self)
9090
end
9191
end
9292

9393
class Symbol
9494
# Output JSON with control characters escaped
9595
# @return [String]
9696
def to_json_c14n
97-
self.to_json
97+
::JSON.generate(self)
9898
end
9999
end
100-

spec/spec_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
require "bundler/setup"
44
require 'rspec'
5+
require 'active_support'
6+
require 'active_support/core_ext'
57

68
begin
79
require 'simplecov'

0 commit comments

Comments
 (0)