Class: Linguadata::Option::Some
- Inherits:
-
Object
- Object
- Linguadata::Option::Some
- Defined in:
- lib/linguadata.rb
Instance Method Summary collapse
- #and_then(&block) ⇒ Object
- #filter(&block) ⇒ Object
- #map(&block) ⇒ Object
- #none? ⇒ Boolean
- #some? ⇒ Boolean
- #unwrap ⇒ Object
- #unwrap_or(_other) ⇒ Object
- #unwrap_or_else(&_block) ⇒ Object
Instance Method Details
#and_then(&block) ⇒ Object
21 |
# File 'lib/linguadata.rb', line 21 def and_then(&block) = block.call(value) |
#filter(&block) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/linguadata.rb', line 23 def filter(&block) if block.call(value) self else None[] end end |
#map(&block) ⇒ Object
11 |
# File 'lib/linguadata.rb', line 11 def map(&block) = Some[block.call(value)] |
#none? ⇒ Boolean
15 |
# File 'lib/linguadata.rb', line 15 def none? = false |
#some? ⇒ Boolean
13 |
# File 'lib/linguadata.rb', line 13 def some? = true |
#unwrap ⇒ Object
9 |
# File 'lib/linguadata.rb', line 9 def unwrap = value |
#unwrap_or(_other) ⇒ Object
19 |
# File 'lib/linguadata.rb', line 19 def unwrap_or(_other) = value |
#unwrap_or_else(&_block) ⇒ Object
17 |
# File 'lib/linguadata.rb', line 17 def unwrap_or_else(&_block) = value |