123456789_123456789_123456789_123456789_123456789_

Class: Gem::Net::WriteAdapter

Relationships & Source Files
Inherits: Object
Defined in: lib/rubygems/vendor/net-protocol/lib/net/protocol.rb

Overview

The writer adapter class

Class Method Summary

Instance Method Summary

Constructor Details

.new(writer) ⇒ WriteAdapter

[ GitHub ]

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

def initialize(writer)
  @writer = writer
end

Instance Method Details

#<<(str)

[ GitHub ]

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

def <<(str)
  write str
  self
end

#inspect

[ GitHub ]

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

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

#printf(*args)

[ GitHub ]

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

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

#puts(str = '')

[ GitHub ]

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

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

#write(str) Also known as: #print

[ GitHub ]

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

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