method
underscore
RSpec latest stable (1.3.1)
-
0 notes -
Class: Spec::Example::ExampleMethods
- 1.1.4
- 1.1.12 (0)
- 1.2.0
- 1.2.8
- 1.3.0
- 1.3.1
- What's this?
underscore(camel_cased_word)
private
Hide source
# File lib/spec/example/example_methods.rb, line 160 def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '_'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end