Class: TAlgebra::Monad::Parser::Optional
- Inherits:
-
TAlgebra::Monad::Parser
- Object
- Either
- TAlgebra::Monad::Parser
- TAlgebra::Monad::Parser::Optional
- Defined in:
- lib/t_algebra/monad/parser.rb
Constant Summary
Constants inherited from Either
Instance Attribute Summary
Attributes inherited from TAlgebra::Monad::Parser
Instance Method Summary collapse
Methods inherited from TAlgebra::Monad::Parser
#as_parser, chain_bind, #extract_parsed, #extract_parsed!, failure, fetch, #fetch, #fetch!, fetch!, #initialize, #is_a?, #optional, parse, #validate, #with_name
Methods included from SingleValued
Methods inherited from Either
#==, #from_either, #from_either!, left, #left?, pure, #right?, #to_obj
Constructor Details
This class inherits a constructor from TAlgebra::Monad::Parser
Instance Method Details
#bind(&block) ⇒ Object
93 94 95 96 97 |
# File 'lib/t_algebra/monad/parser.rb', line 93 def bind(&block) return dup if failure? || value.nil? required.bind(&block).optional end |
#fmap(&block) ⇒ Object
99 100 101 102 103 |
# File 'lib/t_algebra/monad/parser.rb', line 99 def fmap(&block) return dup if failure? || value.nil? required.fmap(&block).optional end |