Module: RoSupport::StringHandler::Common

Included in:
RoSupport::StringHandler
Defined in:
lib/ro_support/string_handler/common.rb

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


4
5
6
7
# File 'lib/ro_support/string_handler/common.rb', line 4

def blank?
  result = self.gsub /\s/, ''
  result.empty?
end

#camelizeObject



9
10
11
12
13
14
15
# File 'lib/ro_support/string_handler/common.rb', line 9

def camelize
  r = self.split('_').map do |e|
    e[0] = e[0].upcase
    e
  end
  r.join
end

#collect(str, sign, filter = nil, &blk) ⇒ Object



21
22
23
24
25
# File 'lib/ro_support/string_handler/common.rb', line 21

def collect(str, sign, filter = nil, &blk)
  new_str_arr = collect_sign(str, sign, filter, &blk)

  new_str = new_str_arr.join
end

#uncamelizeObject



17
18
19
# File 'lib/ro_support/string_handler/common.rb', line 17

def uncamelize
  self.split(/(?=[A-Z])/).join("_").downcase
end