Check super method to be called and force no arguments if none expected
This fixes an issue with Ruby 2.6 where `super` usage when no
arguments are passed results in an argument error
This commit is contained in:
parent
e89d344770
commit
0401f9cad4
@ -12,7 +12,12 @@ module VagrantPlugins
|
||||
@broker = opts.delete(:broker)
|
||||
raise ArgumentError,
|
||||
"Expected `Broker' to be provided" if @broker.nil?
|
||||
super
|
||||
|
||||
if self.method(:initialize).super_method.parameters.empty?
|
||||
super()
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -10,7 +10,12 @@ module VagrantPlugins
|
||||
|
||||
def initialize(*args, **opts, &block)
|
||||
@logger = Log4r::Logger.new(self.class.name.downcase)
|
||||
super
|
||||
|
||||
if self.method(:initialize).super_method.parameters.empty?
|
||||
super()
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -14,7 +14,12 @@ module VagrantPlugins
|
||||
if respond_to?(:broker)
|
||||
@mapper.add_argument(broker)
|
||||
end
|
||||
super
|
||||
|
||||
if self.method(:initialize).super_method.parameters.empty?
|
||||
super()
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user