Module: VER::Methods::Basic
- Defined in:
- lib/ver/methods/basic.rb
Class Method Summary collapse
- .minibuf_eval(buffer) ⇒ Object
- .open_console(text) ⇒ Object
- .open_terminal(text) ⇒ Object
- .quit(text) ⇒ Object
- .status_evaluate(text) ⇒ Object
Class Method Details
.minibuf_eval(buffer) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ver/methods/basic.rb', line 34 def minibuf_eval(buffer) bind = buffer.binding buffer.ask 'Eval: ' do |answer, action| case action when :attempt begin buffer.(eval(answer, bind).inspect) rescue Exception => ex buffer.warn("#{ex.class}: #{ex}") end :abort when :complete EvalCompleter.complete(answer, bind) end end end |
.open_console(text) ⇒ Object
77 78 79 |
# File 'lib/ver/methods/basic.rb', line 77 def open_console(text) Buffer::Console.new(text) end |
.open_terminal(text) ⇒ Object
72 73 74 75 |
# File 'lib/ver/methods/basic.rb', line 72 def open_terminal(text) require 'ver/buffer/term' Buffer::Terminal.new(text) end |
.quit(text) ⇒ Object
53 54 55 |
# File 'lib/ver/methods/basic.rb', line 53 def quit(text) text.quit end |
.status_evaluate(text) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ver/methods/basic.rb', line 57 def status_evaluate(text) text.ask 'Eval expression: ' do |answer, action| case action when :attempt begin result = text.instance_eval(answer) text. result.inspect rescue Exception => ex text.("#{ex.class}: #{ex}") end :abort end end end |