Skip to content

Commit

Permalink
fix title method
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiago Rodrigues committed Jul 7, 2016
1 parent ffa2dff commit ddcc947
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion marathon/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ def default(self, obj):
return obj


def to_title(title_str):
return re.sub(r"[A-Za-z0-9]+('[A-Za-z0-9]+)?", lambda mo: mo.group(0)[0].upper() + mo.group(0)[1:].lower(), title_str)


def to_camel_case(snake_str):
words = snake_str.split('_')
return words[0] + ''.join(w.title() for w in words[1:])
return words[0] + ''.join(to_title(w) for w in words[1:])


def to_snake_case(camel_str):
Expand Down

0 comments on commit ddcc947

Please sign in to comment.