Class: Pronto::Formatter::GithubStatusFormatter::Inflector
- Inherits:
-
Object
- Object
- Pronto::Formatter::GithubStatusFormatter::Inflector
- Defined in:
- lib/pronto/formatter/github_status_formatter/inflector.rb
Class Method Summary collapse
Class Method Details
.underscore(camel_cased_word) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/pronto/formatter/github_status_formatter/inflector.rb', line 5 def self.underscore(camel_cased_word) return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/ word = camel_cased_word.to_s.gsub(/::/, '/') word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2') word.gsub!(/([a-z\d])([A-Z])/, '\1_\2') word.tr!('-', '_') word.downcase! word end |