class Parslet::Atoms::Ignored
Ignores the result of a match.
Example:
str('foo') # will return 'foo', str('foo').ignore # will return nil
Attributes
parslet[R]
Public Class Methods
new(parslet)
click to toggle source
Calls superclass method
# File lib/parslet/atoms/ignored.rb, line 10 def initialize(parslet) super() @parslet = parslet end
Public Instance Methods
apply(source, context, consume_all)
click to toggle source
# File lib/parslet/atoms/ignored.rb, line 16 def apply(source, context, consume_all) success, _ = result = parslet.apply(source, context, consume_all) return result unless success succ(nil) end
to_s_inner(prec)
click to toggle source
# File lib/parslet/atoms/ignored.rb, line 23 def to_s_inner(prec) "ignored(#{parslet.to_s(prec)})" end