Method: Decode::Syntax::Rewriter#apply
- Defined in:
- lib/decode/syntax/rewriter.rb
#apply(output = []) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/decode/syntax/rewriter.rb', line 42 def apply(output = []) offset = 0 @matches.sort.each do |match| if match.offset > offset output << text_for(offset...match.offset) offset = match.offset elsif match.offset < offset # Match intersects last output buffer. next end offset += match.apply(output, self) end if offset < @text.size output << text_for(offset...@text.size) end return output end |