Skip to content

Commit

Permalink
Fix constant redefinition warning
Browse files Browse the repository at this point in the history
In e18fe2a the Jbuilder::VERSION constant was introduced but in 9aa3dd9
it was used in the gemspec which changed the loading order so that the
version constant was loaded first. This defined Jbuilder as an Object
subclass rather than the intended BasicObject and when jbuilder/jbuilder
was required it redefined the Jbuilder constant and obliterates the
VERSION constant. This commit ensures that the version constant exists
and the Jbuilder parent class is BasicObject.
  • Loading branch information
pixeltrix committed Sep 18, 2024
1 parent 9e0540b commit edf849b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion lib/jbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'jbuilder/blank'
require 'jbuilder/key_formatter'
require 'jbuilder/errors'
require 'jbuilder/version'
require 'json'
require 'active_support/core_ext/hash/deep_merge'

Expand Down
2 changes: 1 addition & 1 deletion lib/jbuilder/errors.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'jbuilder/jbuilder'
require 'jbuilder/version'

class Jbuilder
class NullError < ::NoMethodError
Expand Down
2 changes: 1 addition & 1 deletion lib/jbuilder/jbuilder.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Jbuilder = Class.new(BasicObject)
require 'jbuilder/version'
2 changes: 1 addition & 1 deletion lib/jbuilder/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class Jbuilder
class Jbuilder < BasicObject
VERSION = "2.13.0"
end

0 comments on commit edf849b

Please sign in to comment.