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.13.0 lib/xcake/core_ext/string.rb
xcake-0.12.1 lib/xcake/core_ext/string.rb
xcake-0.12.0 lib/xcake/core_ext/string.rb
xcake-0.11.0 lib/xcake/core_ext/string.rb
xcake-0.10.0 lib/xcake/core_ext/string.rb
xcake-0.9.4 lib/xcake/core_ext/string.rb
xcake-0.9.3 lib/xcake/core_ext/string.rb
xcake-0.9.2 lib/xcake/core_ext/string.rb
xcake-0.9.1 lib/xcake/core_ext/string.rb
xcake-0.9.0 lib/xcake/core_ext/string.rb
xcake-0.8.13 lib/xcake/core_ext/string.rb
xcake-0.8.12 lib/xcake/core_ext/string.rb
xcake-0.8.10 lib/xcake/core_ext/string.rb
xcake-0.8.9 lib/xcake/core_ext/string.rb
xcake-0.8.8 lib/xcake/core_ext/string.rb
xcake-0.8.7 lib/xcake/core_ext/string.rb
xcake-0.8.6 lib/xcake/core_ext/string.rb
xcake-0.8.3 lib/xcake/core_ext/string.rb
xcake-0.8.1 lib/xcake/core_ext/string.rb
xcake-0.7.1 lib/xcake/core_ext/string.rb