Skip to content

Commit 3df0457

Browse files
committed
Remove redundant wrapper method
The is_constant_defined? method was added in 3d43d86 to account for behavior differences between Ruby 1.8 and 1.9. It was simplified in 84a9cb8 as part of removal Ruby 1.8 support and the method exists now as a fairly transparent wrapper of Ruby's built-in Module#const_defined? method. is_constant_defined? has been marked as private since 79889af in 2013. This method removes the is_constant_defined? method and substitutes it with Module#const_defined? instead.
1 parent 15cb786 commit 3df0457

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/puppet/util/classgen.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def genmodule(name, options = {}, &block)
6666
def rmclass(name, options)
6767
const = genconst_string(name, options)
6868
retval = false
69-
if is_constant_defined?(const)
69+
if const_defined?(const, false)
7070
remove_const(const)
7171
retval = true
7272
end
@@ -140,19 +140,13 @@ class << self
140140
klass
141141
end
142142

143-
# @api private
144-
#
145-
def is_constant_defined?(const)
146-
const_defined?(const, false)
147-
end
148-
149143
# Handle the setting and/or removing of the associated constant.
150144
# @api private
151145
#
152146
def handleclassconst(klass, name, options)
153147
const = genconst_string(name, options)
154148

155-
if is_constant_defined?(const)
149+
if const_defined?(const, false)
156150
if options[:overwrite]
157151
Puppet.info _("Redefining %{name} in %{klass}") % { name: name, klass: self }
158152
remove_const(const)

0 commit comments

Comments
 (0)