Class: DynamicsCRM::StringUtil
- Inherits:
-
Object
- Object
- DynamicsCRM::StringUtil
- Defined in:
- lib/dynamics_crm.rb
Class Method Summary collapse
Class Method Details
.underscore(str) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/dynamics_crm.rb', line 49 def self.underscore(str) str.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |
.valueOf(text) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/dynamics_crm.rb', line 57 def self.valueOf(text) # Convert text to actual data types. value = text if value == "true" || value == "false" value = (value == "true") elsif value =~ /^[-?]\d+$/ value = value.to_i elsif value =~ /^[-?]\d+\.\d+$/ value = value.to_f else value end end |