Sha256: bce0d35f51eb1286b04c60e874bd625d90dbb82392c26185fc7f0a6a495de433
Contents?: true
Size: 524 Bytes
Versions: 1
Compression:
Stored size: 524 Bytes
Contents
# Collect alternatives to an array by pushing them onto an internal # instance variable @__alternatives. We can then assemble all the alternatives # (including self) into an Array. This is used for specifying alternative # RightHandSides in a Rule in a Grammar. class Array def __alternatives @__alternatives ||= Array.new end def /(other) self.__alternatives << other self end def assemble_alternatives alternatives = self.__alternatives alternatives.unshift self alternatives end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rockit-0.7.1 | lib/util/array_alternatives.rb |