Module: SnakeCaseUtility
- Included in:
- ConcordionStringUtility
- Defined in:
- lib/concordion_string_utility.rb
Instance Method Summary collapse
- #snake_case(str) ⇒ Object
- #snake_cased_goldmaster_name(str) ⇒ Object
- #snake_cased_test_name(str) ⇒ Object
Instance Method Details
#snake_case(str) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/concordion_string_utility.rb', line 4 def snake_case(str) s = str.gsub( /([A-Z])/, '_\1') if s.index("_") == 0 s = s.slice(1, s.length) end s.downcase end |
#snake_cased_goldmaster_name(str) ⇒ Object
19 20 21 |
# File 'lib/concordion_string_utility.rb', line 19 def snake_cased_goldmaster_name(str) snake_cased_test_name(str).gsub(".html", "_goldmaster.html") end |
#snake_cased_test_name(str) ⇒ Object
13 14 15 16 17 |
# File 'lib/concordion_string_utility.rb', line 13 def snake_cased_test_name(str) s = snake_case(str) s = s.gsub(/_test$/, '') "#{s}.html" end |