Sha256: 252165bea8cebad563d79008cf095971cd056626190a78c75443c0e02c7d75fd

Contents?: true

Size: 374 Bytes

Versions: 16

Compression:

Stored size: 374 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 = self.scan(/^[ \t]*(?=\S)/).min
    indent_len = (indent || "").length
    self.gsub(/^[ \t]{#{indent_len}}/, "")
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
xcake-0.6.19 lib/xcake/core_ext/string.rb
xcake-0.6.18 lib/xcake/core_ext/string.rb
xcake-0.6.17 lib/xcake/core_ext/string.rb
xcake-0.6.16 lib/xcake/core_ext/string.rb
xcake-0.6.14 lib/xcake/core_ext/string.rb
xcake-0.6.13 lib/xcake/core_ext/string.rb
xcake-0.6.12 lib/xcake/core_ext/string.rb
xcake-0.6.11 lib/xcake/core_ext/string.rb
xcake-0.6.10 lib/xcake/core_ext/string.rb
xcake-0.6.9 lib/xcake/core_ext/string.rb
xcake-0.6.8 lib/xcake/core_ext/string.rb
xcake-0.6.7 lib/xcake/core_ext/string.rb
xcake-0.6.6 lib/xcake/core_ext/string.rb
xcake-0.6.5 lib/xcake/core_ext/string.rb
xcake-0.6.4 lib/xcake/core_ext/string.rb
xcake-0.6.2 lib/xcake/core_ext/string.rb