Class: Juvet::String

Inherits:
Object
  • Object
show all
Defined in:
lib/juvet/string.rb

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ String

Returns a new instance of String.



3
4
5
# File 'lib/juvet/string.rb', line 3

def initialize(string)
  @string = string.to_s
end

Instance Method Details

#classifyObject



7
8
9
# File 'lib/juvet/string.rb', line 7

def classify
  string.split("_").map{ |w| w.capitalize }.join
end

#underscoreObject



11
12
13
14
# File 'lib/juvet/string.rb', line 11

def underscore
  modified = string.gsub(/(.)([A-Z])/,'\1_\2')
  modified.downcase
end