module Rinne

Constants

VERSION

Public Class Methods

camelize(spell) click to toggle source
# File lib/rinne.rb, line 6
def camelize(spell)
  spell.split("-").map! {|module_word|
    module_word.split("_").map { |class_word|
      class_word.capitalize!
    }.join
  }.join("::")
end
Also aliased as: tensei
classify(path, filetype = "*") click to toggle source
# File lib/rinne.rb, line 15
def classify(path, filetype = "*")
  camelize File.basename(path, ".#{filetype}")
end
tensei(spell)
Alias for: camelize
to_snake(str) click to toggle source
# File lib/rinne.rb, line 19
def to_snake(str)
  str.gsub(/::/, '/').
    gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
    gsub(/([a-z\d])([A-Z])/,'\1_\2').
    tr("-","_").downcase
end