module Spiker

Spiker is a simple spike generator.

Constants

VERSION

Public Class Methods

classify(str) click to toggle source
# File lib/spiker.rb, line 9
def self.classify(str)
  str.split(/[^A-Za-z0-0]/).map(&:capitalize).join
end
snake_case(str) click to toggle source
# File lib/spiker.rb, line 13
def self.snake_case(str)
  # lifted from ActiveSupport inflectors
  str.gsub(/::/, "/")
     .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
     .gsub(/([a-z\d])([A-Z])/, '\1_\2')
     .tr("-", "_")
     .downcase
end