Skip to content

Commit b32714d

Browse files
Remove Json::ParseError assignment (#402)
The constant was copied over from grape when grape_entity/json.rb was introduced, but grape-entity never parses JSON and so never used it. Because the main grape gem also defines JSON::ParseError, loading both gems produced `already initialized constant` warnings. Dropping the assignment silences the warnings with no behavior change. Originally flagged in #385 by @ericproulx.
1 parent 1b272d8 commit b32714d

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#### Fixes
88

99
* Your contribution here.
10-
10+
* [#402](https://github.com/ruby-grape/grape-entity/pull/402): Remove `Json::ParseError` assignment - [@olivier-thatch](https://github.com/olivier-thatch).
1111

1212
### 1.0.3 (2026-04-15)
1313

lib/grape_entity/json.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
module Grape
44
class Entity
5-
if defined?(::MultiJson)
6-
Json = ::MultiJson
7-
else
8-
Json = ::JSON
9-
Json::ParseError = Json::ParserError
10-
end
5+
Json = defined?(::MultiJson) ? ::MultiJson : ::JSON
116
end
127
end

0 commit comments

Comments
 (0)