I have a class that needs to be initialized, but these names are placed as follows:
SomeThing::MyClass.new()
But I am calling it from args in a rake task, so it goes in line:
task :blah, [:my_class_name] => :environment do |t, args| class_name = args[:my_class_name].camelize.constantize puts class_name end
So, obviously, if I call the rake command as follows:
rake blah[my_class]
My task returns:
MyClass
But how can I get it to run from a namespace chained to another method, for example:
SomeThing::MyClass.new()
From the string provided as input?
source share