Invalid haskey? method

The haskey? method you are calling to check required arguments is not valid. It should be has_key? instead.