Class: IRB

Inherits:
Object
  • Object
show all
Defined in:
lib/tailog/ext/irb.rb

Defined Under Namespace

Classes: Irb, WorkSpace

Class Method Summary collapse

Class Method Details

.evaluate_string(string) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tailog/ext/irb.rb', line 10

def evaluate_string string
  conf[:PROMPT_MODE] = :DEFAULT
  conf[:VERBOSE] = false
  conf[:OUTPUT] = []

  irb = IRB::Irb.new nil, StringInputMethod.new(string + "\nexit\n")
  conf[:MAIN_CONTEXT] = irb.context
  irb.eval_input

  result = conf[:OUTPUT]
  conf[:OUTPUT] = nil
  result
end

.irb_exit(irb, ret) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/tailog/ext/irb.rb', line 26

def irb_exit irb, ret
  if IRB.Output
    ret
  else
    raw_irb_exit irb, ret
  end
end

.OutputObject



6
7
8
# File 'lib/tailog/ext/irb.rb', line 6

def Output
  conf[:OUTPUT]
end

.raw_irb_exitObject



24
# File 'lib/tailog/ext/irb.rb', line 24

alias_method :raw_irb_exit, :irb_exit