class Coppy::Name

Attributes

underscore[R]

Public Class Methods

new(name) click to toggle source
# File lib/coppy/name.rb, line 3
def initialize(name)
  @underscore = name
    .gsub(/::/, '/')
    .gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
    .gsub(/([a-z\d])([A-Z])/,'\1_\2')
    .tr("-", "_")
    .downcase
end

Public Instance Methods

camelcase() click to toggle source
# File lib/coppy/name.rb, line 14
def camelcase
  @underscore.split('_').map(&:capitalize).join
end