Class: DynamicsCRM::StringUtil
- Inherits:
-
Object
- Object
- DynamicsCRM::StringUtil
- Defined in:
- lib/dynamics_crm.rb
Class Method Summary collapse
Class Method Details
.underscore(str) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/dynamics_crm.rb', line 60 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
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/dynamics_crm.rb', line 68 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 |