diff --git a/.github/matrix.json b/.github/matrix.json index 81e37ac5f94..f15a18dd692 100644 --- a/.github/matrix.json +++ b/.github/matrix.json @@ -1,5 +1,5 @@ { "postgresql": ["12"], - "ruby": ["2.7"], + "ruby": ["2.7", "3.0"], "node": ["14"] } diff --git a/app/models/host.rb b/app/models/host.rb index 12d7d98593e..ec5f43d07f1 100644 --- a/app/models/host.rb +++ b/app/models/host.rb @@ -1,18 +1,16 @@ module Host - def self.method_missing(method, *args, &block) + def self.method_missing(method, *args, **kwargs, &block) type = "Host::Managed" case method.to_s when /create/, 'new' - if args.empty? || args[0].nil? # got no parameters - # set the default type - args = [{:type => type}] - else # got some parameters - args[0][:type] ||= type # adds the type if it doesn't exists - type = args[0][:type] # stores the type for later usage. + if kwargs.key?(:type) + type = kwargs[:type] + else + kwargs[:type] = type end end if type.constantize.respond_to?(method, true) - type.constantize.send(method, *args, &block) + type.constantize.send(method, *args, **kwargs, &block) else super end