Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/xcode/core_ext/string.rb
Instance Method Summary collapse
-
#to_xcplist ⇒ Object
Xcode format for a string is exactly the same as you would expect in JSON.
-
#underscore ⇒ String
Similar to ActiveRecord’s underscore method.
Instance Method Details
#to_xcplist ⇒ Object
Xcode format for a string is exactly the same as you would expect in JSON
8 9 10 |
# File 'lib/xcode/core_ext/string.rb', line 8 def to_xcplist to_json end |
#underscore ⇒ String
Similar to ActiveRecord’s underscore method. Return a string version underscored. This is used specifically to convert the property keys into Ruby friendly names as they are used for creating method names.
19 20 21 22 23 24 25 |
# File 'lib/xcode/core_ext/string.rb', line 19 def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |