Module: RoSupport::StringHandler::Common
- Included in:
- RoSupport::StringHandler
- Defined in:
- lib/ro_support/string_handler/common.rb
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #camelize ⇒ Object
- #collect(str, sign, filter = nil, &blk) ⇒ Object
- #uncamelize ⇒ Object
Instance Method Details
#blank? ⇒ Boolean
4 5 6 7 |
# File 'lib/ro_support/string_handler/common.rb', line 4 def blank? result = self.gsub /\s/, '' result.empty? end |
#camelize ⇒ Object
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 |
#uncamelize ⇒ Object
17 18 19 |
# File 'lib/ro_support/string_handler/common.rb', line 17 def uncamelize self.split(/(?=[A-Z])/).join("_").downcase end |