simplecov 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -7
- data/.gitignore +0 -1
- data/.rubocop.yml +69 -0
- data/.travis.yml +12 -0
- data/CHANGELOG.md +59 -21
- data/Gemfile +22 -15
- data/MIT-LICENSE +1 -1
- data/README.md +198 -176
- data/Rakefile +17 -8
- data/doc/alternate-formatters.md +36 -0
- data/doc/commercial-services.md +20 -0
- data/doc/editor-integration.md +13 -0
- data/features/rspec_basic.feature +3 -2
- data/features/rspec_groups_and_filters_complex.feature +2 -0
- data/features/rspec_groups_using_filter_class.feature +3 -2
- data/features/step_definitions/html_steps.rb +6 -7
- data/features/step_definitions/simplecov_steps.rb +18 -16
- data/features/step_definitions/transformers.rb +2 -2
- data/features/step_definitions/web_steps.rb +4 -4
- data/features/support/env.rb +18 -15
- data/lib/simplecov/command_guesser.rb +33 -34
- data/lib/simplecov/configuration.rb +238 -234
- data/lib/simplecov/defaults.rb +37 -36
- data/lib/simplecov/exit_codes.rb +7 -5
- data/lib/simplecov/file_list.rb +38 -36
- data/lib/simplecov/filter.rb +12 -2
- data/lib/simplecov/formatter/simple_formatter.rb +1 -1
- data/lib/simplecov/formatter.rb +2 -2
- data/lib/simplecov/jruby_fix.rb +4 -4
- data/lib/simplecov/last_run.rb +15 -13
- data/lib/simplecov/merge_helpers.rb +26 -27
- data/lib/simplecov/no_defaults.rb +2 -2
- data/lib/simplecov/profiles.rb +21 -19
- data/lib/simplecov/railtie.rb +1 -1
- data/lib/simplecov/railties/tasks.rake +7 -7
- data/lib/simplecov/result.rb +5 -5
- data/lib/simplecov/result_merger.rb +65 -62
- data/lib/simplecov/source_file.rb +23 -24
- data/lib/simplecov/version.rb +20 -1
- data/lib/simplecov.rb +35 -24
- data/simplecov.gemspec +15 -12
- data/test/faked_project/Gemfile +5 -5
- data/test/faked_project/Rakefile +4 -4
- data/test/faked_project/features/step_definitions/my_steps.rb +3 -4
- data/test/faked_project/features/support/env.rb +5 -5
- data/test/faked_project/lib/faked_project/some_class.rb +3 -4
- data/test/faked_project/lib/faked_project.rb +1 -1
- data/test/faked_project/spec/faked_spec.rb +2 -2
- data/test/faked_project/spec/forking_spec.rb +7 -0
- data/test/faked_project/spec/meta_magic_spec.rb +1 -1
- data/test/faked_project/spec/some_class_spec.rb +3 -3
- data/test/faked_project/spec/spec_helper.rb +4 -8
- data/test/faked_project/test/faked_test.rb +2 -2
- data/test/faked_project/test/meta_magic_test.rb +1 -1
- data/test/faked_project/test/some_class_test.rb +3 -3
- data/test/faked_project/test/test_helper.rb +5 -9
- data/test/fixtures/app/controllers/sample_controller.rb +1 -1
- data/test/fixtures/app/models/user.rb +1 -1
- data/test/fixtures/deleted_source_sample.rb +3 -3
- data/test/fixtures/frameworks/rspec_bad.rb +4 -4
- data/test/fixtures/frameworks/rspec_good.rb +4 -4
- data/test/fixtures/frameworks/testunit_bad.rb +3 -3
- data/test/fixtures/frameworks/testunit_good.rb +3 -3
- data/test/fixtures/resultset2.rb +0 -1
- data/test/fixtures/sample.rb +1 -1
- data/test/fixtures/utf-8.rb +1 -1
- data/test/helper.rb +9 -11
- data/test/test_1_8_fallbacks.rb +7 -7
- data/test/test_command_guesser.rb +8 -8
- data/test/test_deleted_source.rb +3 -3
- data/test/test_file_list.rb +9 -7
- data/test/test_filters.rb +30 -14
- data/test/test_merge_helpers.rb +31 -24
- data/test/test_result.rb +32 -23
- data/test/test_return_codes.rb +10 -6
- data/test/test_source_file.rb +5 -38
- data/test/test_source_file_line.rb +17 -17
- metadata +146 -64
- data/lib/simplecov/json.rb +0 -27
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "helper"
|
|
2
2
|
|
|
3
|
-
class TestSourceFileLine < Test
|
|
3
|
+
class TestSourceFileLine < Minitest::Test
|
|
4
4
|
context "A source line" do
|
|
5
5
|
setup do
|
|
6
|
-
@line = SimpleCov::SourceFile::Line.new(
|
|
6
|
+
@line = SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3)
|
|
7
7
|
end
|
|
8
8
|
subject { @line }
|
|
9
9
|
|
|
10
10
|
should 'return "# the ruby source" as src' do
|
|
11
|
-
assert_equal
|
|
11
|
+
assert_equal "# the ruby source", @line.src
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
should
|
|
14
|
+
should "return the same for source as for src" do
|
|
15
15
|
assert_equal @line.src, @line.source
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
should
|
|
18
|
+
should "have line number 5" do
|
|
19
19
|
assert_equal 5, @line.line_number
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
should
|
|
22
|
+
should "have equal line_number, line and number" do
|
|
23
23
|
assert_equal @line.line_number, @line.line
|
|
24
24
|
assert_equal @line.line_number, @line.number
|
|
25
25
|
end
|
|
@@ -31,13 +31,13 @@ class TestSourceFileLine < Test::Unit::TestCase
|
|
|
31
31
|
should_be :skipped?
|
|
32
32
|
should_not_be :missed?
|
|
33
33
|
should_not_be :never?
|
|
34
|
-
should_have :status,
|
|
34
|
+
should_have :status, "skipped"
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
context "A source line with coverage" do
|
|
39
39
|
setup do
|
|
40
|
-
@line = SimpleCov::SourceFile::Line.new(
|
|
40
|
+
@line = SimpleCov::SourceFile::Line.new("# the ruby source", 5, 3)
|
|
41
41
|
end
|
|
42
42
|
subject { @line }
|
|
43
43
|
|
|
@@ -49,12 +49,12 @@ class TestSourceFileLine < Test::Unit::TestCase
|
|
|
49
49
|
should_not_be :skipped?
|
|
50
50
|
should_not_be :missed?
|
|
51
51
|
should_not_be :never?
|
|
52
|
-
should_have :status,
|
|
52
|
+
should_have :status, "covered"
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
context "A source line without coverage" do
|
|
56
56
|
setup do
|
|
57
|
-
@line = SimpleCov::SourceFile::Line.new(
|
|
57
|
+
@line = SimpleCov::SourceFile::Line.new("# the ruby source", 5, 0)
|
|
58
58
|
end
|
|
59
59
|
subject { @line }
|
|
60
60
|
|
|
@@ -66,12 +66,12 @@ class TestSourceFileLine < Test::Unit::TestCase
|
|
|
66
66
|
should_not_be :skipped?
|
|
67
67
|
should_be :missed?
|
|
68
68
|
should_not_be :never?
|
|
69
|
-
should_have :status,
|
|
69
|
+
should_have :status, "missed"
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
context "A source line with no code" do
|
|
73
73
|
setup do
|
|
74
|
-
@line = SimpleCov::SourceFile::Line.new(
|
|
74
|
+
@line = SimpleCov::SourceFile::Line.new("# the ruby source", 5, nil)
|
|
75
75
|
end
|
|
76
76
|
subject { @line }
|
|
77
77
|
|
|
@@ -83,23 +83,23 @@ class TestSourceFileLine < Test::Unit::TestCase
|
|
|
83
83
|
should_not_be :skipped?
|
|
84
84
|
should_not_be :missed?
|
|
85
85
|
should_be :never?
|
|
86
|
-
should_have :status,
|
|
86
|
+
should_have :status, "never"
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
should "raise ArgumentError when initialized with invalid src" do
|
|
90
|
-
|
|
90
|
+
assert_raises ArgumentError do
|
|
91
91
|
SimpleCov::SourceFile::Line.new(:symbol, 5, 3)
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
should "raise ArgumentError when initialized with invalid line_number" do
|
|
96
|
-
|
|
96
|
+
assert_raises ArgumentError do
|
|
97
97
|
SimpleCov::SourceFile::Line.new("some source", "five", 3)
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
should "raise ArgumentError when initialized with invalid coverage" do
|
|
102
|
-
|
|
102
|
+
assert_raises ArgumentError do
|
|
103
103
|
SimpleCov::SourceFile::Line.new("some source", 5, "three")
|
|
104
104
|
end
|
|
105
105
|
end
|
metadata
CHANGED
|
@@ -1,69 +1,70 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simplecov
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
3
|
+
version: &id002 !ruby/object:Gem::Version
|
|
4
|
+
version: 0.10.0
|
|
5
5
|
platform: ruby
|
|
6
|
-
authors:
|
|
6
|
+
authors:
|
|
7
7
|
- Christoph Olszowka
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.0'
|
|
11
|
+
|
|
12
|
+
date: 2015-04-18 00:00:00 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
20
15
|
type: :runtime
|
|
16
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
|
17
|
+
requirements:
|
|
18
|
+
- - ~>
|
|
19
|
+
- !ruby/object:Gem::Version
|
|
20
|
+
version: "1.8"
|
|
21
|
+
requirement: *id001
|
|
22
|
+
prerelease: false
|
|
23
|
+
name: json
|
|
24
|
+
- !ruby/object:Gem::Dependency
|
|
25
|
+
type: :runtime
|
|
26
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
|
27
|
+
requirements:
|
|
28
|
+
- - ~>
|
|
29
|
+
- *id002
|
|
30
|
+
requirement: *id003
|
|
21
31
|
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
32
|
name: simplecov-html
|
|
29
|
-
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.8.0
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
34
|
type: :runtime
|
|
35
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ~>
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 1.1.0
|
|
40
|
+
requirement: *id004
|
|
35
41
|
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.8.0
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: docile
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
- !ruby/object:Gem::Dependency
|
|
44
|
+
type: :development
|
|
45
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ~>
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: "1.9"
|
|
50
|
+
requirement: *id005
|
|
49
51
|
prerelease: false
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: 1.1.0
|
|
55
|
-
description: Code coverage for Ruby 1.9+ with a powerful configuration library and
|
|
56
|
-
automatic merging of coverage across test suites
|
|
57
|
-
email:
|
|
52
|
+
name: bundler
|
|
53
|
+
description: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites
|
|
54
|
+
email:
|
|
58
55
|
- christoph at olszowka de
|
|
59
56
|
executables: []
|
|
57
|
+
|
|
60
58
|
extensions: []
|
|
59
|
+
|
|
61
60
|
extra_rdoc_files: []
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
61
|
+
|
|
62
|
+
files:
|
|
63
|
+
- .gitignore
|
|
64
|
+
- .rspec
|
|
65
|
+
- .rubocop.yml
|
|
66
|
+
- .travis.yml
|
|
67
|
+
- .yardopts
|
|
67
68
|
- CHANGELOG.md
|
|
68
69
|
- CONTRIBUTING.md
|
|
69
70
|
- Gemfile
|
|
@@ -71,6 +72,9 @@ files:
|
|
|
71
72
|
- README.md
|
|
72
73
|
- Rakefile
|
|
73
74
|
- cucumber.yml
|
|
75
|
+
- doc/alternate-formatters.md
|
|
76
|
+
- doc/commercial-services.md
|
|
77
|
+
- doc/editor-integration.md
|
|
74
78
|
- features/config_autoload.feature
|
|
75
79
|
- features/config_command_name.feature
|
|
76
80
|
- features/config_coverage_dir.feature
|
|
@@ -115,7 +119,6 @@ files:
|
|
|
115
119
|
- lib/simplecov/formatter/multi_formatter.rb
|
|
116
120
|
- lib/simplecov/formatter/simple_formatter.rb
|
|
117
121
|
- lib/simplecov/jruby_fix.rb
|
|
118
|
-
- lib/simplecov/json.rb
|
|
119
122
|
- lib/simplecov/last_run.rb
|
|
120
123
|
- lib/simplecov/merge_helpers.rb
|
|
121
124
|
- lib/simplecov/no_defaults.rb
|
|
@@ -138,6 +141,7 @@ files:
|
|
|
138
141
|
- test/faked_project/lib/faked_project/meta_magic.rb
|
|
139
142
|
- test/faked_project/lib/faked_project/some_class.rb
|
|
140
143
|
- test/faked_project/spec/faked_spec.rb
|
|
144
|
+
- test/faked_project/spec/forking_spec.rb
|
|
141
145
|
- test/faked_project/spec/meta_magic_spec.rb
|
|
142
146
|
- test/faked_project/spec/some_class_spec.rb
|
|
143
147
|
- test/faked_project/spec/spec_helper.rb
|
|
@@ -170,28 +174,106 @@ files:
|
|
|
170
174
|
- test/test_source_file.rb
|
|
171
175
|
- test/test_source_file_line.rb
|
|
172
176
|
homepage: http://github.com/colszowka/simplecov
|
|
173
|
-
licenses:
|
|
177
|
+
licenses:
|
|
174
178
|
- MIT
|
|
175
179
|
metadata: {}
|
|
180
|
+
|
|
176
181
|
post_install_message:
|
|
177
182
|
rdoc_options: []
|
|
178
|
-
|
|
183
|
+
|
|
184
|
+
require_paths:
|
|
179
185
|
- lib
|
|
180
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
|
-
requirements:
|
|
186
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
|
+
requirements:
|
|
182
188
|
- - ">="
|
|
183
|
-
- !ruby/object:Gem::Version
|
|
184
|
-
version:
|
|
185
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
|
-
requirements:
|
|
189
|
+
- !ruby/object:Gem::Version
|
|
190
|
+
version: 1.8.7
|
|
191
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
|
+
requirements:
|
|
187
193
|
- - ">="
|
|
188
|
-
- !ruby/object:Gem::Version
|
|
189
|
-
version:
|
|
194
|
+
- !ruby/object:Gem::Version
|
|
195
|
+
version: "0"
|
|
190
196
|
requirements: []
|
|
197
|
+
|
|
191
198
|
rubyforge_project:
|
|
192
|
-
rubygems_version: 2.
|
|
199
|
+
rubygems_version: 2.4.6
|
|
193
200
|
signing_key:
|
|
194
201
|
specification_version: 4
|
|
195
|
-
summary: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic
|
|
196
|
-
|
|
197
|
-
|
|
202
|
+
summary: Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites
|
|
203
|
+
test_files:
|
|
204
|
+
- features/config_autoload.feature
|
|
205
|
+
- features/config_command_name.feature
|
|
206
|
+
- features/config_coverage_dir.feature
|
|
207
|
+
- features/config_deactivate_merging.feature
|
|
208
|
+
- features/config_formatters.feature
|
|
209
|
+
- features/config_merge_timeout.feature
|
|
210
|
+
- features/config_nocov_token.feature
|
|
211
|
+
- features/config_profiles.feature
|
|
212
|
+
- features/config_project_name.feature
|
|
213
|
+
- features/config_styles.feature
|
|
214
|
+
- features/cucumber_basic.feature
|
|
215
|
+
- features/maximum_coverage_drop.feature
|
|
216
|
+
- features/merging_test_unit_and_rspec.feature
|
|
217
|
+
- features/minimum_coverage.feature
|
|
218
|
+
- features/refuse_coverage_drop.feature
|
|
219
|
+
- features/rspec_basic.feature
|
|
220
|
+
- features/rspec_fails_on_initialization.feature
|
|
221
|
+
- features/rspec_groups_and_filters_basic.feature
|
|
222
|
+
- features/rspec_groups_and_filters_complex.feature
|
|
223
|
+
- features/rspec_groups_using_filter_class.feature
|
|
224
|
+
- features/rspec_without_simplecov.feature
|
|
225
|
+
- features/skipping_code_blocks_manually.feature
|
|
226
|
+
- features/step_definitions/html_steps.rb
|
|
227
|
+
- features/step_definitions/simplecov_steps.rb
|
|
228
|
+
- features/step_definitions/transformers.rb
|
|
229
|
+
- features/step_definitions/web_steps.rb
|
|
230
|
+
- features/support/env.rb
|
|
231
|
+
- features/test_unit_basic.feature
|
|
232
|
+
- features/test_unit_groups_and_filters_basic.feature
|
|
233
|
+
- features/test_unit_groups_and_filters_complex.feature
|
|
234
|
+
- features/test_unit_groups_using_filter_class.feature
|
|
235
|
+
- features/test_unit_without_simplecov.feature
|
|
236
|
+
- features/unicode_compatiblity.feature
|
|
237
|
+
- test/faked_project/Gemfile
|
|
238
|
+
- test/faked_project/Rakefile
|
|
239
|
+
- test/faked_project/cucumber.yml
|
|
240
|
+
- test/faked_project/features/step_definitions/my_steps.rb
|
|
241
|
+
- test/faked_project/features/support/env.rb
|
|
242
|
+
- test/faked_project/features/test_stuff.feature
|
|
243
|
+
- test/faked_project/lib/faked_project.rb
|
|
244
|
+
- test/faked_project/lib/faked_project/framework_specific.rb
|
|
245
|
+
- test/faked_project/lib/faked_project/meta_magic.rb
|
|
246
|
+
- test/faked_project/lib/faked_project/some_class.rb
|
|
247
|
+
- test/faked_project/spec/faked_spec.rb
|
|
248
|
+
- test/faked_project/spec/forking_spec.rb
|
|
249
|
+
- test/faked_project/spec/meta_magic_spec.rb
|
|
250
|
+
- test/faked_project/spec/some_class_spec.rb
|
|
251
|
+
- test/faked_project/spec/spec_helper.rb
|
|
252
|
+
- test/faked_project/test/faked_test.rb
|
|
253
|
+
- test/faked_project/test/meta_magic_test.rb
|
|
254
|
+
- test/faked_project/test/some_class_test.rb
|
|
255
|
+
- test/faked_project/test/test_helper.rb
|
|
256
|
+
- test/fixtures/app/controllers/sample_controller.rb
|
|
257
|
+
- test/fixtures/app/models/user.rb
|
|
258
|
+
- test/fixtures/deleted_source_sample.rb
|
|
259
|
+
- test/fixtures/frameworks/rspec_bad.rb
|
|
260
|
+
- test/fixtures/frameworks/rspec_good.rb
|
|
261
|
+
- test/fixtures/frameworks/testunit_bad.rb
|
|
262
|
+
- test/fixtures/frameworks/testunit_good.rb
|
|
263
|
+
- test/fixtures/iso-8859.rb
|
|
264
|
+
- test/fixtures/resultset1.rb
|
|
265
|
+
- test/fixtures/resultset2.rb
|
|
266
|
+
- test/fixtures/sample.rb
|
|
267
|
+
- test/fixtures/utf-8.rb
|
|
268
|
+
- test/helper.rb
|
|
269
|
+
- test/shoulda_macros.rb
|
|
270
|
+
- test/test_1_8_fallbacks.rb
|
|
271
|
+
- test/test_command_guesser.rb
|
|
272
|
+
- test/test_deleted_source.rb
|
|
273
|
+
- test/test_file_list.rb
|
|
274
|
+
- test/test_filters.rb
|
|
275
|
+
- test/test_merge_helpers.rb
|
|
276
|
+
- test/test_result.rb
|
|
277
|
+
- test/test_return_codes.rb
|
|
278
|
+
- test/test_source_file.rb
|
|
279
|
+
- test/test_source_file_line.rb
|
data/lib/simplecov/json.rb
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require 'multi_json'
|
|
2
|
-
|
|
3
|
-
module SimpleCov::JSON
|
|
4
|
-
class << self
|
|
5
|
-
def parse(json)
|
|
6
|
-
# Detect and use available MultiJson API - it changed in v1.3
|
|
7
|
-
if MultiJson.respond_to?(:adapter)
|
|
8
|
-
MultiJson.load(json)
|
|
9
|
-
else
|
|
10
|
-
MultiJson.decode(json)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def dump(string)
|
|
15
|
-
if defined? ::JSON
|
|
16
|
-
::JSON.pretty_generate(string)
|
|
17
|
-
else
|
|
18
|
-
# Detect and use available MultiJson API - it changed in v1.3
|
|
19
|
-
if MultiJson.respond_to?(:adapter)
|
|
20
|
-
MultiJson.dump(string)
|
|
21
|
-
else
|
|
22
|
-
MultiJson.encode(string)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|