So idea is to define
def foo
puts "Works!"
end
and directly from the console without loading anything I write
irb(main):001:0>foo()
=> "Works!"
irb(main):002:0>
I am using 1.9.3 on Windows. I want to use this in order to have a method which will reload lib/* so that I don’t need to restart the console. Thank you.
I think this is what you’re asking… I have the following code in an initializer:
and any extra methods I want in the console defined in
lib/util/console_extensions.rbThis automatically requires and includes the
ConsoleExtensionmodule when loading the rails console and makes the methods defined in it available without the need to manually load anything.