Class: Gem::Net::ReadAdapter
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rubygems/vendor/net-protocol/lib/net/protocol.rb |
Overview
internal use only
Class Method Summary
- .new(block) ⇒ ReadAdapter constructor
Instance Method Summary
- #<<(str)
- #inspect
-
#call_block(str) {|str| ... }
private
This method is needed because @block must be called by yield, not
Proc#call
.
Constructor Details
.new(block) ⇒ ReadAdapter
# File 'lib/rubygems/vendor/net-protocol/lib/net/protocol.rb', line 517
def initialize(block) @block = block end
Instance Method Details
#<<(str)
[ GitHub ]# File 'lib/rubygems/vendor/net-protocol/lib/net/protocol.rb', line 525
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.
# File 'lib/rubygems/vendor/net-protocol/lib/net/protocol.rb', line 534
def call_block(str) yield str end
#inspect
[ GitHub ]# File 'lib/rubygems/vendor/net-protocol/lib/net/protocol.rb', line 521
def inspect "#<#{self.class}>" end