Class: Net::WriteAdapter
- Inherits:
-
Object
- Object
- Net::WriteAdapter
- Defined in:
- lib/net/protocol.rb
Overview
The writer adapter class
Instance Method Summary collapse
- #<<(str) ⇒ Object
-
#initialize(socket, method) ⇒ WriteAdapter
constructor
A new instance of WriteAdapter.
- #inspect ⇒ Object
- #printf(*args) ⇒ Object
- #puts(str = '') ⇒ Object
- #write(str) ⇒ Object (also: #print)
Constructor Details
#initialize(socket, method) ⇒ WriteAdapter
Returns a new instance of WriteAdapter.
362 363 364 365 |
# File 'lib/net/protocol.rb', line 362 def initialize(socket, method) @socket = socket @method_id = method end |
Instance Method Details
#<<(str) ⇒ Object
377 378 379 380 |
# File 'lib/net/protocol.rb', line 377 def <<(str) write str self end |
#inspect ⇒ Object
367 368 369 |
# File 'lib/net/protocol.rb', line 367 def inspect "#<#{self.class} socket=#{@socket.inspect}>" end |
#printf(*args) ⇒ Object
386 387 388 |
# File 'lib/net/protocol.rb', line 386 def printf(*args) write sprintf(*args) end |
#puts(str = '') ⇒ Object
382 383 384 |
# File 'lib/net/protocol.rb', line 382 def puts(str = '') write str.chomp("\n") + "\n" end |
#write(str) ⇒ Object Also known as: print
371 372 373 |
# File 'lib/net/protocol.rb', line 371 def write(str) @socket.__send__(@method_id, str) end |