Created
June 23, 2010 01:55
-
-
Save bherrmann7/449376 to your computer and use it in GitHub Desktop.
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
// assert schema2hibernate('take_this') == 'takeThis' | |
def schema2hibernate = { table_name -> | |
boolean lastUnder = false | |
table_name.collect { | |
if( it == '_' ){ | |
lastUnder = true | |
return '' | |
} | |
if (lastUnder) { | |
lastUnder = false | |
return it.toUpperCase() | |
} | |
it | |
}.join('') | |
} | |
assert schema2hibernate('take_this') == 'takeThis' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment