Class: VSTS::BaseModel
- Inherits:
-
Object
- Object
- VSTS::BaseModel
- Defined in:
- lib/vsts/base_model.rb
Overview
Ancestor class for all VSTS models
Instance Method Summary collapse
-
#underscore(word) ⇒ Object
Convert camel-case to underscore-case, ie.
Instance Method Details
#underscore(word) ⇒ Object
Convert camel-case to underscore-case, ie. helloWorld to hello_world
6 7 8 9 10 11 12 |
# File 'lib/vsts/base_model.rb', line 6 def underscore(word) word.to_s.gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr("-", "_") .downcase end |