No implicit conversion of Hash into String (Ruby)

No implicit conversion of Hash into String (Ruby)

Your commands is currently an array of hashes:

commands = [disconnect => PART ##{CHANNEL}]
#=> [{disconnect=>PART #SomeChannelHere}]

You have to use { ... } instead of [ ... ]:

commands = {disconnect => PART ##{CHANNEL}}
#=> {disconnect=>PART #SomeChannelHere}

Furthermore, the each block expects two arguments (key and value):

commands.each do |command, response|
  # ...
end

You are missing the key of the hash:

commands.each do |command|
 p command[disconnect]
 p command.has_key?(disconnect)
end

No implicit conversion of Hash into String (Ruby)

Leave a Reply

Your email address will not be published. Required fields are marked *