module Shale::Utils
Utitlity functions
@api private
Public Class Methods
underscore(word)
click to toggle source
Convert word to under score
@param [String] word
@example
Shale::Utils.underscore('FooBar') # => foo_bar Shale::Utils.underscore('Namespace::FooBar') # => namespace:foo_bar
@api private
# File lib/shale/utils.rb, line 17 def self.underscore(word) word .gsub('::', ':') .gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .downcase end