diff options
| author | Ryan Waldron <rew@erebor.com> | 2012-06-12 16:56:37 -0500 |
|---|---|---|
| committer | Ryan Waldron <rew@erebor.com> | 2012-06-12 16:56:37 -0500 |
| commit | b2488e01900cebfb50155ccacf4ccb147f13d0d0 (patch) | |
| tree | 730c6fe77f54c9ded2a85f12eed403de77b6f563 /lib/waldo/string.rb | |
| parent | 9229d90a2657bc74f0764a41a0f2aaa896965ef7 (diff) | |
Rename gem from emerson to waldo
Diffstat (limited to 'lib/waldo/string.rb')
| -rw-r--r-- | lib/waldo/string.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/waldo/string.rb b/lib/waldo/string.rb new file mode 100644 index 00000000..efd38b55 --- /dev/null +++ b/lib/waldo/string.rb @@ -0,0 +1,12 @@ +unless String.instance_methods.include? 'underscore' + class String + # Yes, oh Rails, I stealz you so bad + def underscore + self.gsub(/::/, '/'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). + gsub(/([a-z\d])([A-Z])/,'\1_\2'). + tr("-", "_"). + downcase + end + end +end
\ No newline at end of file |
