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.
138 139 140 |
# File 'lib/ripe/blocks/block.rb', line 138 def +(block) self.|(block) end |
#|(block) ⇒ Block
If attempting to compose a new block with a nil element, ignore the nil element.
130 131 132 133 |
# File 'lib/ripe/blocks/block.rb', line 130 def |(block) raise NoMethodError unless Ripe::Blocks::Block > block.class block end |