Class: L43Peg::Success

Inherits:
Object
  • Object
show all
Extended by:
L43::OpenObject
Defined in:
lib/l43_peg/success.rb

Instance Method Summary collapse

Instance Method Details

#debugObject



11
12
13
14
15
16
# File 'lib/l43_peg/success.rb', line 11

def debug
  "Success<" +
    [
      "ast:#{ast.inspect}", "parsed:#{parsed.inspect}", "rest:#{rest.src.inspect}"
    ].join(" ") + ">"
end

#deconstructObject



25
# File 'lib/l43_peg/success.rb', line 25

def deconstruct(*) = [:ok, ast, rest]

#map(box: nil, &mapper) ⇒ Object



18
19
20
21
22
23
# File 'lib/l43_peg/success.rb', line 18

def map(box: nil, &mapper)
  update_attribute(:ast, &mapper)
    .update_attribute_if(:ast, box) do |ast|
      Box.make(box).new(ast)
    end
end