Chris Roberts 0401f9cad4
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
2022-04-25 12:24:42 -05:00

28 lines
595 B
Ruby

module VagrantPlugins
module CommandServe
module Util
# Adds mapper initialization and will include
module HasMapper
def mapper
@mapper
end
def initialize(*args, **opts, &block)
@cacher = Cacher.new
@mapper = Mappers.new
@mapper.cacher = @cacher
if respond_to?(:broker)
@mapper.add_argument(broker)
end
if self.method(:initialize).super_method.parameters.empty?
super()
else
super
end
end
end
end
end
end