> Maybe if you don't like the idea of adding any of this sugar, you could > help me understand this code: > > # File 'lib/parslet/atoms/sequence.rb', line 18 > > def >>(parslet) > self.class.new(* @parslets+[parslet]) > end >
What this does, step by step: - @parslets + [parslet] - create a new array including @parslet and parslet (unfortunate naming there) - * array - splat the array as individual arguments to the method - self.class.new(arg1, arg2, ...) - create a new Sequence, having the arguments given as subatoms. hope that helps kaspar
