To be honest I don't get what you want achieve here. You test Args(0) for map and then convert Args(1). I think it is typo.
I think it should looks like (with few tricks from recent ruby bindings):
```ruby
if WFM.Args.size == 0
  y2error("missing autoyast command")
  return
end
def main
  function = WFM.Args.first
  params  = if WFM.Args.size > 1 && Ops.is_map?(WFM.Args[1])
      WFM.Args[1]
    else
      {}
    end

  ...
```