Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/xcake/core_ext/string.rb

Instance Method Summary collapse

Instance Method Details

#strip_heredocObject

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_cObject

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_cObject

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