Folks,
I have a config/settings.yml file that looks like this:
lab_options: mappings_hash: {can_type: "Tumor::OncologyRun.basic_test"}
then in my model app/models/tumor.rb I wanted to do something like this
def sync_tumor_test
Settings.lab_options.mappings_hash.to_hash[:can_type](age, demographic)
end
In the above case I want to call the method Tumor::OncologyRun.basic_test with arguments age and demographics. The method Tumor::OncologyRun.basic_test is present in lib/tumor/oncology_run.rb and looks like this:
module Tumor
module OncologyRun
def OncologyRun.basic_test(age, demographics)
#code here
end
end
end
I know that in ruby method names are strings, so how do I call this with arguments, when I am trying this from the rails console with something like send(Settings.lab_options.mappings_hash.to_hash[:can_type](age, demographic)) I get a NOMethod Error any feedback is much much appreciated, thanks a lot