Class: Console::Mux::Shell
Overview
The interactive console is run within an instance of Shell. All instance methods are thus available as user commands.
Instance Attribute Summary collapse
- 
  
    
      #console  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute console. 
Class Method Summary collapse
Instance Method Summary collapse
- #commands ⇒ Object
- 
  
    
      #initialize(console)  ⇒ Shell 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Shell. 
- 
  
    
      #with_defaults(hash = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Yield the block with hashmerged into the default options.
Constructor Details
#initialize(console) ⇒ Shell
Returns a new instance of Shell.
| 49 50 51 | # File 'lib/console/mux/shell.rb', line 49 def initialize(console) @console = console end | 
Instance Attribute Details
#console ⇒ Object (readonly)
Returns the value of attribute console.
| 26 27 28 | # File 'lib/console/mux/shell.rb', line 26 def console @console end | 
Class Method Details
.delegate(obj_getter, method_syms) ⇒ Object
| 29 30 31 32 33 34 35 36 | # File 'lib/console/mux/shell.rb', line 29 def delegate(obj_getter, method_syms) method_syms.each do |sym| send(:define_method, sym) do |*args, &block| obj = send(obj_getter) obj.send(sym, *args, &block) end end end | 
.delegate_ok(obj_getter, method_syms) ⇒ Object
| 38 39 40 41 42 43 44 45 46 | # File 'lib/console/mux/shell.rb', line 38 def delegate_ok(obj_getter, method_syms) method_syms.each do |sym| send(:define_method, sym) do |*args, &block| obj = send(obj_getter) obj.send(sym, *args, &block) :ok end end end | 
Instance Method Details
#commands ⇒ Object
| 53 54 55 | # File 'lib/console/mux/shell.rb', line 53 def commands console.commands end | 
#with_defaults(hash = {}) ⇒ Object
Yield the block with hash merged into the default options. The options are restored.
| 75 76 77 78 79 80 81 82 83 | # File 'lib/console/mux/shell.rb', line 75 def with_defaults(hash={}) = (.merge(hash)) begin yield ensure () end end |