Class: PrayRemote::InputProxy

Inherits:
Struct
  • Object
show all
Includes:
DRab::DRabUndumped
Defined in:
lib/pray-remote/pray-remote.rb

Overview

A class to represent an input object created from DRab. This is used because Pry checks for arity to know if a prompt should be passed to the object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#input#readline

Object to proxy

Returns:

  • (#readline)

    the current value of input



103
104
105
# File 'lib/pray-remote/pray-remote.rb', line 103

def input
  @input
end

Instance Method Details

#completion_proc=(val) ⇒ Object



123
124
125
# File 'lib/pray-remote/pray-remote.rb', line 123

def completion_proc=(val)
  input.completion_proc = val
end

#readline(prompt) ⇒ Object

Reads a line from the input



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/pray-remote/pray-remote.rb', line 111

def readline(prompt)
  arity = readline_arity
  case
  when arity == 1 then
    input.readline(prompt)
  when arity < 0 then
    input.readline(prompt)
  when arity == 0 then
    input.readline
  end
end

#readline_arityObject



127
128
129
130
131
# File 'lib/pray-remote/pray-remote.rb', line 127

def readline_arity
  input.readline_arity
rescue NameError
  0
end