Class: Gem::Net::WriteAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/vendor/net-protocol/lib/net/protocol.rb

Overview

The writer adapter class

Instance Method Summary collapse

Constructor Details

#initialize(writer) ⇒ WriteAdapter

Returns a new instance of WriteAdapter.



487
488
489
# File 'lib/rubygems/vendor/net-protocol/lib/net/protocol.rb', line 487

def initialize(writer)
  @writer = writer
end

Instance Method Details

#<<(str) ⇒ Object



501
502
503
504
# File 'lib/rubygems/vendor/net-protocol/lib/net/protocol.rb', line 501

def <<(str)
  write str
  self
end

#inspectObject



491
492
493
# File 'lib/rubygems/vendor/net-protocol/lib/net/protocol.rb', line 491

def inspect
  "#<#{self.class} writer=#{@writer.inspect}>"
end

#printf(*args) ⇒ Object



510
511
512
# File 'lib/rubygems/vendor/net-protocol/lib/net/protocol.rb', line 510

def printf(*args)
  write sprintf(*args)
end

#puts(str = '') ⇒ Object



506
507
508
# File 'lib/rubygems/vendor/net-protocol/lib/net/protocol.rb', line 506

def puts(str = '')
  write str.chomp("\n") + "\n"
end

#write(str) ⇒ Object Also known as: print



495
496
497
# File 'lib/rubygems/vendor/net-protocol/lib/net/protocol.rb', line 495

def write(str)
  @writer.call(str)
end