module StaticTracing::Tracer::Helpers

Public Instance Methods

underscore(class_name) click to toggle source
# File lib/ruby-static-tracing/tracer/helpers.rb, line 7
def underscore(class_name)
  class_name.gsub(/::/, '_')
            .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
            .gsub(/([a-z\d])([A-Z])/, '\1_\2')
            .tr('-', '_')
            .downcase
end