Class: Net::WriteAdapter
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/net/protocol.rb |
Overview
The writer adapter class
Class Method Summary
- .new(socket, method) ⇒ WriteAdapter constructor
Instance Method Summary
- #<<(str)
- #inspect
-
#print(str)
Alias for #write.
- #printf(*args)
- #puts(str = '')
- #write(str) (also: #print)
Constructor Details
.new(socket, method) ⇒ WriteAdapter
# File 'lib/net/protocol.rb', line 448
def initialize(socket, method) @socket = socket @method_id = method end
Instance Method Details
#<<(str)
[ GitHub ]# File 'lib/net/protocol.rb', line 463
def <<(str) write str self end
#inspect
[ GitHub ]# File 'lib/net/protocol.rb', line 453
def inspect "#<#{self.class} socket=#{@socket.inspect}>" end
#print(str)
Alias for #write.
# File 'lib/net/protocol.rb', line 461
alias print write
#printf(*args)
[ GitHub ]# File 'lib/net/protocol.rb', line 472
def printf(*args) write sprintf(*args) end
#puts(str = '')
[ GitHub ]# File 'lib/net/protocol.rb', line 468
def puts(str = '') write str.chomp("\n") + "\n" end
#write(str) Also known as: #print
[ GitHub ]# File 'lib/net/protocol.rb', line 457
def write(str) @socket.__send__(@method_id, str) end