Module: Soap::String
- Defined in:
- lib/soap/string.rb
Class Method Summary collapse
Class Method Details
.camelcase(str) ⇒ Object
17 18 19 |
# File 'lib/soap/string.rb', line 17 def self.camelcase(str) str.split("_").collect(&:capitalize).join end |
.snakecase(str) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/soap/string.rb', line 6 def self.snakecase(str) str = str.dup str.gsub!(/::/, "/") str.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2') str.gsub!(/([a-z\d])([A-Z])/, '\1_\2') str.tr!(".", "_") str.tr!("-", "_") str.downcase! str end |
.wsdl_camelcase(str) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/soap/string.rb', line 21 def self.wsdl_camelcase(str) str_split = str.split("_") return str_split.first if str_split.count == 1 first_split = str_split.delete_at(0) last_split = str_split.delete_at(str_split.count - 1) if last_split.length <= 3 last_split.upcase! else last_split.capitalize! end "#{first_split}#{str_split.collect(&:capitalize).join}#{last_split}" end |