Module: Consolize
- Defined in:
- lib/consolize.rb
Class Method Summary collapse
Class Method Details
.included(mod) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/consolize.rb', line 11 def self.included(mod) mod.module_eval do @console = Console.new def self.console @console end def self.setup_console(&block) console = @console @console.on("quit") do console.exit end @console.on("") do puts "Giving me the silent treatment, eh?" end @console.instance_exec(console, &block) end def console self.class.console.run(self) end end end |