Module: VER::Methods::Basic

Defined in:
lib/ver/methods/basic.rb

Class Method Summary collapse

Class Method Details

.open_console(text) ⇒ Object



48
49
50
# File 'lib/ver/methods/basic.rb', line 48

def open_console(text)
  Buffer::Console.new(text)
end

.open_terminal(text) ⇒ Object



43
44
45
46
# File 'lib/ver/methods/basic.rb', line 43

def open_terminal(text)
  require 'ver/buffer/term'
  Buffer::Terminal.new(text)
end

.quit(text) ⇒ Object



6
7
8
# File 'lib/ver/methods/basic.rb', line 6

def quit(text)
  Save.quit(text)
end

.source_buffer(text) ⇒ Object



10
11
12
13
# File 'lib/ver/methods/basic.rb', line 10

def source_buffer(text)
  VER.message "Source #{text.filename}"
  TOPLEVEL_BINDING.eval(text.value.to_s)
end

.status_evaluate(text) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ver/methods/basic.rb', line 15

def status_evaluate(text)
  text.ask 'Eval expression: ' do |answer, action|
    case action
    when :attempt
      begin
        result = text.instance_eval(answer)
        VER.message result.inspect
      rescue Exception => ex
        VER.message("#{ex.class}: #{ex}")
      end
      :abort
    end
  end
end

.tags_at(text, index = :insert) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ver/methods/basic.rb', line 30

def tags_at(text, index = :insert)
  index = text.index(index)
  tags = text.tag_names(index)
  VER.message tags.inspect

  require 'ver/tooltip'

  tooltip = Tk::Tooltip.new(tags.inspect)
  tooltip.show_on(text)

  Tk::After.ms(5000){ tooltip.destroy }
end