Sha256: 6b3e66804b9a38cac3a60118df5679daea96be17b562c59516d9c9605ee43c18

Contents?: true

Size: 364 Bytes

Versions: 27

Compression:

Stored size: 364 Bytes

Contents

class String
  # Escapes string for use with Objective-C
  #
  def to_obj_c
    "\\\@\\\"#{self}\\\""
  end

  # Escapes string for use with C
  #
  def to_c
    "\\\"#{self}\\\""
  end

  # Strips heredoc indents
  #
  def strip_heredoc
    indent = scan(/^[ \t]*(?=\S)/).min
    indent_len = (indent || '').length
    gsub(/^[ \t]{#{indent_len}}/, '')
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
xcake-0.7.0 lib/xcake/core_ext/string.rb
xcake-0.6.25 lib/xcake/core_ext/string.rb
xcake-0.6.24 lib/xcake/core_ext/string.rb
xcake-0.6.23 lib/xcake/core_ext/string.rb
xcake-0.6.22 lib/xcake/core_ext/string.rb
xcake-0.6.21 lib/xcake/core_ext/string.rb
xcake-0.6.20 lib/xcake/core_ext/string.rb