Class: NilClass
- Inherits:
-
Object
- Object
- NilClass
- Defined in:
- lib/ripe/blocks/block.rb
Overview
NilClass is monkey-patched+ to provide syntactic sugar for Block#| and Block#+ by treating nil like an empty block.
Instance Method Summary collapse
-
#+(block) ⇒ Block
If attempting to compose a new block with a
nilelement, ignore thenilelement. -
#|(block) ⇒ Block
If attempting to compose a new block with a
nilelement, ignore thenilelement.
Instance Method Details
#+(block) ⇒ Block
If attempting to compose a new block with a nil element, ignore the nil element.
140 141 142 |
# File 'lib/ripe/blocks/block.rb', line 140 def +(block) self.|(block) end |
#|(block) ⇒ Block
If attempting to compose a new block with a nil element, ignore the nil element.
132 133 134 135 |
# File 'lib/ripe/blocks/block.rb', line 132 def |(block) raise NoMethodError unless Ripe::Blocks::Block > block.class block end |