How can I execute a method in a module from the Rails console?

module, ruby-on-rails

Solution

To run it from the rails console you just have to include it:

> include Reports::MyMod
> mymethod

Problem

I have a module in a file called `my_mod.rb` declared like this: ``` module Reports module MyMod def mymethod ... end end end ``` I just want to run `mymethod`. It's not a class method obviously, so I can't run it like: ``` Reports::MyMod.mymethod ``` and yet I was hoping there was some way to get the method evaluated by the parser without have to go through a bunch of module_eval and module_function stuff. It should be easier than that, shouldn't it?

Original source