module SimpleEnumeration
Constants
- VERSION
Public Class Methods
camelcase(string)
click to toggle source
# File lib/simple_enumeration.rb, line 24 def self.camelcase(string) string.split('_').map do |w| w[0] = w[0].upcase w end.join end
extended(receiver)
click to toggle source
# File lib/simple_enumeration.rb, line 20 def self.extended(receiver) receiver.extend DefineSimpleEnumeration end
underscore(string)
click to toggle source
# File lib/simple_enumeration.rb, line 31 def self.underscore(string) string .gsub('::', '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .downcase end