Module: Kernel

Defined in:
lib/irt/extensions/rails_server.rb,
lib/irt/extensions/kernel.rb

Overview

this file patches the rack server and irt in order to enter irt from the server execution you should require this file after loading irt.rb

Instance Method Summary collapse

Instance Method Details

#capture(stream = :stdout) ⇒ Object Also known as: silence

copied from ActiveRecord 3.1 because of conflicting name with previous IRT implementation modified in the argument default in order to be used by both AR and IRT



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/irt/extensions/kernel.rb', line 6

def capture(stream=:stdout)
  begin
    stream = stream.to_s
    eval "$#{stream} = StringIO.new"
    yield
    result = eval("$#{stream}").string
  ensure
    eval("$#{stream} = #{stream.upcase}")
  end

  result
end

#irt(bind) ⇒ Object



20
21
22
23
24
# File 'lib/irt/extensions/kernel.rb', line 20

def irt(bind)
  raise IRT::ArgumentTypeError, "You must pass binding instead of #{bind.class.name} object" unless bind.is_a?(Binding)
  IRT.start
  IRT::Session.enter :binding, bind
end

#original_irtObject



6
7
8
9
10
# File 'lib/irt/extensions/rails_server.rb', line 6

def irt(bind)
  raise IRT::ArgumentTypeError, "You must pass binding instead of #{bind.class.name} object" unless bind.is_a?(Binding)
  IRT.start
  IRT::Session.enter :binding, bind
end