Prepared_hash

class Hash
  def insert(*args)
    Hash[self.keys[..args.size-1].zip(args)].each {|k,v|
      self[k] = v
    } if args.size <= self.size
    self
  end
end

hsh = {x: 10, y: 20, width: 200, height: 100, color: 'blue'}

p hsh.insert(5, 8)
# => {:x=>5, :y=>8, :width=>200, :height=>100, :color=>"blue"}

p hsh.insert(10, 20, 300, 150, 'orange')
# => {:x=>10, :y=>20, :width=>300, :height=>150, :color=>"orange"}


# Example :

class Apa
  def initialize(x:, y:, name:, border: false)
    @x, @y = x, y
    @name = name
    @border = border
  end
end

parms = {x: nil, y: nil, name: '', border: true}

apa = Apa.new(**parms.insert(12, 8))
p apa
# => #<Apa:0x000058799cf82398 @y=8, @x=12, @name="", @border=true>