Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/plugin/manager.rb

Overview

support camerize and underscore

Instance Method Summary collapse

Instance Method Details

#camerizeObject



105
106
107
108
109
110
# File 'lib/fusuma/plugin/manager.rb', line 105

def camerize
  split('_').map do |w|
    w[0].upcase!
    w
  end.join
end

#underscoreObject



112
113
114
115
116
117
118
# File 'lib/fusuma/plugin/manager.rb', line 112

def underscore
  gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
    .gsub(/([a-z\d])([A-Z])/, '\1_\2')
    .gsub('::', '/')
    .tr('-', '_')
    .downcase
end