123456789_123456789_123456789_123456789_123456789_

Class: Net::ReadAdapter

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: lib/net/protocol.rb

Overview

internal use only

Class Method Summary

Instance Method Summary

Constructor Details

.new(block) ⇒ ReadAdapter

[ GitHub ]

  
# File 'lib/net/protocol.rb', line 479

def initialize(block)
  @block = block
end

Instance Method Details

#<<(str)

[ GitHub ]

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

def <<(str)
  call_block(str, &@block) if @block
end

#call_block(str) {|str| ... } (private)

This method is needed because @block must be called by yield, not Proc#call. You can see difference when using ‘break’ in the block.

Yields:

  • (str)
[ GitHub ]

  
# File 'lib/net/protocol.rb', line 496

def call_block(str)
  yield str
end

#inspect

[ GitHub ]

  
# File 'lib/net/protocol.rb', line 483

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