Class: String

Inherits:
Object show all
Defined in:
lib/mobility/core_ext/string.rb

Overview

Add String methods camelize and present? to String if activesupport cannot be loaded.

Instance Method Summary collapse

Instance Method Details

#camelizeObject

paraphrased from activesupport



9
10
11
# File 'lib/mobility/core_ext/string.rb', line 9

def camelize
  sub(/^[a-z\d]*/) { $&.capitalize }.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }.gsub('/', '::')
end

#present?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/mobility/core_ext/string.rb', line 13

def present?
  !blank?
end