Module: Drudge::Parsers::ParseResults::ParseResult
- Included in:
- NotSuccess, Success
- Defined in:
- lib/drudge/parsers/parse_results.rb
Overview
Identifies a parse result. It can be a Success or NotSuccess
Instance Method Summary collapse
-
#+(other) ⇒ Object
Combines this result with the other by applying the ‘+’ operator on the underlying ParseValue takes care of failure / success combinatorics are observed.
-
#flat_map ⇒ Object
monadic bind (or flat_map) of two sequential results.
- #flat_map_with_next(&parser_producer) ⇒ Object
-
#map ⇒ Object
applies the provided block to the containing ParseValue returns a new ParseResult containing the modified value.
-
#map_in_parse_value ⇒ Object
applies the provied block to the contained parse value.
-
#success? ⇒ Boolean
returns true if the ParseResult was successful.
Instance Method Details
#+(other) ⇒ Object
Combines this result with the other by applying the ‘+’ operator on the underlying ParseValue takes care of failure / success combinatorics are observed
54 55 56 57 58 59 60 |
# File 'lib/drudge/parsers/parse_results.rb', line 54 def +(other) self.flat_map do |res| other.map do |other_res| res + other_res end end end |
#flat_map ⇒ Object
monadic bind (or flat_map) of two sequential results
47 |
# File 'lib/drudge/parsers/parse_results.rb', line 47 def flat_map; end |
#flat_map_with_next(&parser_producer) ⇒ Object
49 |
# File 'lib/drudge/parsers/parse_results.rb', line 49 def flat_map_with_next(&parser_producer); end |
#map ⇒ Object
applies the provided block to the containing ParseValue returns a new ParseResult containing the modified value
41 |
# File 'lib/drudge/parsers/parse_results.rb', line 41 def map ; end |
#map_in_parse_value ⇒ Object
applies the provied block to the contained parse value
44 |
# File 'lib/drudge/parsers/parse_results.rb', line 44 def map_in_parse_value; end |
#success? ⇒ Boolean
returns true if the ParseResult was successful
63 |
# File 'lib/drudge/parsers/parse_results.rb', line 63 def success?; end |