Safest way to run a method call that's stored in a hash?

Okay I've been looking around for awhile now on different ways to run a method call that is stored up in a hash like the following:

Spoiler
module MyHash Hash = { :call_one => SceneManager.goto(Scene_Title), :call_two => 'SceneManager.goto(Scene_Title)' } #SceneManager.goto(Scene_Title) used as #an exampleendclass Test def self.call_one MyHash::Hash[:call_one] #won't work end def self.call_two eval(MyHash::Hash[:call_two]) #works but I would rather not use eval end def self.call_three instance_eval(MyHash::Hash[:call_two]) #again this works however I am not certain #if this is any better than eval endend
Are there any more ways to run a method that is stored in a hash?  If so/if not which way is the safest?
module MyHash


Data = {


😮ne => [:method_a, 1, 2, 3],


}


end


class Test


def call_method


send(*MyHash:😀ata[😮ne])


end


def method_a(*argz)


puts "Method called with args: #{*argz}"


end


end
I can get send to work for methods that are defined inside of the class Test; however I am not certain how to use it to call methods outside of my class.

(also there's an error in your code had to remove the * from the argz in the puts line)
Could use procs? 
 

Code:
module MyHash    Data = {    :one => Proc::new do |*argz, &blawk|      SceneManager::call(Scene_Title)    end,  }endclass Test    def method_a(*argz, &blawk)    MyHash::Data[:one]::call(*argz, &blawk)  end  end
Must the hash be serializable?

Saving objects containing procs and methods can cause problem, but if marshaling the hash to a file is not an issue for your scenarios I suggest following Dekita's method.

@Dekita:

Why you rebel you, with you bawling blawks and 1337-argz.

*hugs*
Gotta love blawks and argz yo!
@Dekita That is actually really cleaver. 🙂

@Zeriab I don't think that will be a problem as I won't be marshaling any of this part of the script I am working on to a file. 🙂
Nah, you could get more clever with it, but there really isnt any need 😛

Original thread: https://forums.rpgmakerweb.com/threads/safest-way-to-run-a-method-call-thats-stored-in-a-hash.42024/