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(writer) ⇒ WriteAdapter
constructor
:stopdoc:.
- #inspect ⇒ Object
- #printf(*args) ⇒ Object
- #puts(str = '') ⇒ Object
- #write(str) ⇒ Object (also: #print)
Constructor Details
#initialize(writer) ⇒ WriteAdapter
:stopdoc:
541 542 543 |
# File 'lib/net/protocol.rb', line 541 def initialize(writer) @writer = writer end |
Instance Method Details
#<<(str) ⇒ Object
555 556 557 558 |
# File 'lib/net/protocol.rb', line 555 def <<(str) write str self end |
#inspect ⇒ Object
545 546 547 |
# File 'lib/net/protocol.rb', line 545 def inspect "#<#{self.class} writer=#{@writer.inspect}>" end |
#printf(*args) ⇒ Object
564 565 566 |
# File 'lib/net/protocol.rb', line 564 def printf(*args) write sprintf(*args) end |
#puts(str = '') ⇒ Object
560 561 562 |
# File 'lib/net/protocol.rb', line 560 def puts(str = '') write str.chomp("\n") + "\n" end |
#write(str) ⇒ Object Also known as: print
549 550 551 |
# File 'lib/net/protocol.rb', line 549 def write(str) @writer.call(str) end |