Module: StringUtils
- Included in:
- CampingRouting, FileSystemRouting
- Defined in:
- lib/routing/utils/string_utils.rb
Overview
Utilities for strings
Instance Method Summary collapse
-
#snake_of_pascal(str) ⇒ Object
HelloWorld -> hello_world.
Instance Method Details
#snake_of_pascal(str) ⇒ Object
HelloWorld -> hello_world
8 9 10 |
# File 'lib/routing/utils/string_utils.rb', line 8 def snake_of_pascal(str) str.gsub(/([A-Z])/) { |s| "_#{s.downcase}" }[1..] end |