class String

Public Instance Methods

strip_heredoc() click to toggle source

Strips heredoc indents

# 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() click to toggle source

Escapes string for use with C

# File lib/xcake/core_ext/string.rb, line 10
def to_c
  "\\\"#{self}\\\""
end
to_obj_c() click to toggle source

Escapes string for use with Objective-C

# File lib/xcake/core_ext/string.rb, line 4
def to_obj_c
  "\\\@\\\"#{self}\\\""
end