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