Class: PryRemote::IOUndumpedProxy

Inherits:
Object
  • Object
show all
Includes:
DRb::DRbUndumped
Defined in:
lib/pry-remote.rb

Overview

Class used to wrap inputs so that they can be sent through DRb.

This is to ensure the input is used locally and not reconstructed on the server by DRb.

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ IOUndumpedProxy

Returns a new instance of IOUndumpedProxy.



41
42
43
# File 'lib/pry-remote.rb', line 41

def initialize(obj)
  @obj = obj
end

Instance Method Details

#<<(data) ⇒ Object



82
83
84
85
# File 'lib/pry-remote.rb', line 82

def <<(data)
  @obj << data
  self
end

#completion_procObject



51
52
53
# File 'lib/pry-remote.rb', line 51

def completion_proc
  @obj.completion_proc if @obj.respond_to? :completion_proc
end

#completion_proc=(val) ⇒ Object



45
46
47
48
49
# File 'lib/pry-remote.rb', line 45

def completion_proc=(val)
  if @obj.respond_to? :completion_proc=
    @obj.completion_proc = val
  end
end


70
71
72
# File 'lib/pry-remote.rb', line 70

def print(*objs)
  @obj.print(*objs)
end

#printf(*args) ⇒ Object



74
75
76
# File 'lib/pry-remote.rb', line 74

def printf(*args)
  @obj.printf(*args)
end

#puts(*lines) ⇒ Object



66
67
68
# File 'lib/pry-remote.rb', line 66

def puts(*lines)
  @obj.puts(*lines)
end

#readline(prompt) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/pry-remote.rb', line 55

def readline(prompt)
  if Readline == @obj
    @obj.readline(prompt, true)
  elsif @obj.method(:readline).arity == 1
    @obj.readline(prompt)
  else
    $stdout.print prompt
    @obj.readline
  end
end

#tty?Boolean

Some versions of Pry expect $stdout or its output objects to respond to this message.

Returns:

  • (Boolean)


89
90
91
# File 'lib/pry-remote.rb', line 89

def tty?
  false
end

#write(data) ⇒ Object



78
79
80
# File 'lib/pry-remote.rb', line 78

def write(data)
  @obj.write data
end