Skip to content

Instantly share code, notes, and snippets.

@heftig
Created April 5, 2012 02:22
Show Gist options
  • Save heftig/2307508 to your computer and use it in GitHub Desktop.
Save heftig/2307508 to your computer and use it in GitHub Desktop.
TOKEN_PROCESSORS = []
def processor(regex, &proc)
TOKEN_PROCESSORS << [regex, proc]
end
# Finds a word followed by any value
processor /\A([A-z]\w*)\s*([^\n]*)?/ do |chunk, matches|
matches[0].upcase!
return matches
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment