Module: Gem::Release::Helper::String

Included in:
Cmds::Base, Cmds::Base, Data
Defined in:
lib/gem/release/helper/string.rb

Instance Method Summary collapse

Instance Method Details

#camelize(str) ⇒ Object


27
28
29
# File 'lib/gem/release/helper/string.rb', line 27

def camelize(str)
  str.to_s.split(/[^a-z0-9]/i).map { |str| str.capitalize }.join
end

#underscore(str) ⇒ Object


31
32
33
34
35
# File 'lib/gem/release/helper/string.rb', line 31

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

#wrap(str, width) ⇒ Object


37
38
39
# File 'lib/gem/release/helper/string.rb', line 37

def wrap(str, width)
  Wrapper.new(str, width).apply
end