Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/xcake/core_ext/string.rb
Instance Method Summary collapse
-
#strip_heredoc ⇒ Object
Strips heredoc indents.
-
#to_c ⇒ Object
Escapes string for use with C.
-
#to_obj_c ⇒ Object
Escapes string for use with Objective-C.
Instance Method Details
#strip_heredoc ⇒ Object
Strips heredoc indents
16 17 18 19 20 |
# File 'lib/xcake/core_ext/string.rb', line 16 def strip_heredoc indent = scan(/^[ \t]*(?=\S)/).min indent_len = (indent || '').length gsub(/^[ \t]{#{indent_len}}/, '') end |
#to_c ⇒ Object
Escapes string for use with C
10 11 12 |
# File 'lib/xcake/core_ext/string.rb', line 10 def to_c "\\\"#{self}\\\"" end |
#to_obj_c ⇒ Object
Escapes string for use with Objective-C
4 5 6 |
# File 'lib/xcake/core_ext/string.rb', line 4 def to_obj_c "\\\@\\\"#{self}\\\"" end |