Class: PryBot::SharedIO

Inherits:
Object show all
Defined in:
lib/shared-io.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSharedIO



5
6
7
8
9
10
11
# File 'lib/shared-io.rb', line 5

def initialize
  @input = StringIO.new
  @output = StringIO.new

  @input_proxy = PryBot::StringIOProxy.new(@input)
  @output_proxy = PryBot::StringIOProxy.new(@output)
end

Instance Attribute Details

#input_proxyObject

Returns the value of attribute input_proxy.



3
4
5
# File 'lib/shared-io.rb', line 3

def input_proxy
  @input_proxy
end

#output_proxyObject

Returns the value of attribute output_proxy.



3
4
5
# File 'lib/shared-io.rb', line 3

def output_proxy
  @output_proxy
end

Instance Method Details

#pry_eval(string) ⇒ Object



13
14
15
16
17
# File 'lib/shared-io.rb', line 13

def pry_eval(string)
  @input_proxy << string
  sleep 0.1
  @output_proxy.readlines
end