Created
August 29, 2012 12:50
-
-
Save umuro/3512031 to your computer and use it in GitHub Desktop.
Match a ruby metdhod using regex. To use Thor scripts to replace method definitions in existing source code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Match a ruby metdhod using regex. To use Thor scripts to replace method definitions in existing source code. | |
# github: umuro, Umur Ozkul | |
def match_mtd(mtd) | |
/^\s*def (#{mtd})\s+((?!end).)*\s+end\s*$/m | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment