I’m pretty new to ruby, but have some background in Java, and very
C(++) and suchlike.
I’m currently - as a “learning-by-doing”-project - creating a simple
text-based interface for running (more or less) arbitrary programs.
I decided on a simple tree-based structure for the menu itself, however
a bit stuck on the hook between my interface, and the program running
In order to not couple my interface too tightly to my program running
it, I’d really like for my interface to not know what it’s actually
Basically, I just figured I could take a leaf from the
Functional-programming style and give my TextInterface a method to call
I told it to:
which works fine, as long as my method is defined “in the wild”:
puts “foo called”
interface.call_action => foo called
but, how do I handle it if the method is an instance method on some
program = Program.new
No variant of this works for me.
I realise I may be fundamentally wrong in my approach, so any tips would