Class: SocketIOMethod
- Inherits:
-
IRB::StdioInputMethod
- Object
- IRB::StdioInputMethod
- SocketIOMethod
- Defined in:
- lib/live_console.rb
Overview
The SocketIOMethod is a class that wraps I/O over a socket for IRB.
Instance Method Summary collapse
- #file_name ⇒ Object
- #gets ⇒ Object
-
#initialize(socket) ⇒ SocketIOMethod
constructor
A new instance of SocketIOMethod.
- #print(*a) ⇒ Object
Constructor Details
#initialize(socket) ⇒ SocketIOMethod
Returns a new instance of SocketIOMethod.
130 131 132 133 134 |
# File 'lib/live_console.rb', line 130 def initialize(socket) @socket = socket @line = [] @line_no = 0 end |
Instance Method Details
#file_name ⇒ Object
153 154 155 |
# File 'lib/live_console.rb', line 153 def file_name @socket.inspect end |
#gets ⇒ Object
136 137 138 139 140 141 142 |
# File 'lib/live_console.rb', line 136 def gets @socket.print @prompt @socket.flush @line[@line_no += 1] = @socket.gets @socket.flush @line[@line_no] end |
#print(*a) ⇒ Object
149 150 151 |
# File 'lib/live_console.rb', line 149 def print(*a) @socket.print *a end |