Store functions in hash
问题 I know that in Ruby you can create hash maps like this: hash = {"name"=>"John"} But is it possible to have a hash map of methods: hash = {"v"=> show_version} and when calling hash["v"] either to execute the show_version function, or to return some kind on pointer that passed to some special method, to execute the function from the hash? What I am trying to achieve, is to have a hash map of methods, instead of using a case/when construction, as it looks too verbose to me. 回答1: Not exactly like