Class: Rsec::Unbox

Inherits:
Unary
  • Object
show all
Defined in:
lib/rsec/parsers/seq.rb

Overview

unbox result size only work for seq and join and maybe’ed seq and join

Instance Attribute Summary

Attributes inherited from Unary

#some

Attributes included from Parser

#name

Instance Method Summary collapse

Methods included from Parser

#&, #*, #<<, #>>, #^, #cached, #eof, #fail, #inspect, #join, #map, #maybe, #parse, #parse!, #star, #|

Instance Method Details

#_parse(ctx) ⇒ Object



75
76
77
78
79
# File 'lib/rsec/parsers/seq.rb', line 75

def _parse ctx
  res = some._parse ctx
  return INVALID if INVALID[res]
  res.size == 1 ? res.first : res
end