lundi 27 juin 2016

How do I pass an if block to eval in ruby

I need to pass an if block as a string to an eval statement.

I tried the following:

if "replace-chronic" == "nil"  
               br = BotResponse.new(@bot_client_id, "bad chronic", @via)
               br.run
              end

But I keep getting an unexpected keyword_end or the like.

What is the right way to send multi line block as a string for eval

Aucun commentaire:

Enregistrer un commentaire