Ruby convert string to method name

前端 未结 4 1179
醉话见心
醉话见心 2020-12-28 12:43

I have two methods defined in my ruby file.

def is_mandatory(string)
      puts xyz
end
def is_alphabets(string)
      puts abc 
end 

An

4条回答
  •  星月不相逢
    2020-12-28 13:29

    You can also add hash to send parameters to the method.

    send("method_name", "abc", {add more parameters in this hash})
    

提交回复
热议问题