Method: Stockade.process
- Defined in:
- lib/stockade.rb
.process(text, action) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/stockade.rb', line 31 def process(text, action) lexemes(text).inject(text) do |mask, lexeme| prefix = lexeme.start_pos.zero? ? '' : mask[0..lexeme.start_pos - 1] postfix = mask[lexeme.end_pos..-1] "#{prefix}#{lexeme.send(action)}#{postfix}" end end |