Skip to content

Commit f447b60

Browse files
pixeltrixrafaelfranca
authored andcommitted
Fix constant redefinition warning
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.
1 parent 13e033b commit f447b60

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

lib/jbuilder.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
require 'jbuilder/blank'
66
require 'jbuilder/key_formatter'
77
require 'jbuilder/errors'
8-
require 'jbuilder/version'
98
require 'json'
109
require 'active_support/core_ext/hash/deep_merge'
1110

lib/jbuilder/errors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'jbuilder/jbuilder'
3+
require 'jbuilder/version'
44

55
class Jbuilder
66
class NullError < ::NoMethodError

lib/jbuilder/jbuilder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# frozen_string_literal: true
22

3-
Jbuilder = Class.new(BasicObject)
3+
require 'jbuilder/version'

lib/jbuilder/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

3-
class Jbuilder
3+
class Jbuilder < BasicObject
44
VERSION = "2.13.0"
55
end

0 commit comments

Comments
 (0)