module Sass::SCSS::RX

def self.escape_char(c)

Other tags:
    Private: -

Returns:
  • (String) - The escaped character

Parameters:
  • c (String) -- The character to escape. Should have length 1
def self.escape_char(c)
  return "\\%06x" % Haml::Util.ord(c) unless c =~ /[ -\/:-~]/
  return "\\#{c}"
end

def self.escape_ident(str)

Returns:
  • (String) - The escaped string

Parameters:
  • str (String) -- The string to escape
def self.escape_ident(str)
  return "" if str.empty?
  return "\\#{str}" if str == '-' || str == '_'
  out = ""
  value = str.dup
  out << value.slice!(0...1) if value =~ /^[-_]/
  if value[0...1] =~ NMSTART
    out << value.slice!(0...1)
  else
    out << escape_char(value.slice!(0...1))
  end
  out << value.gsub(/[^a-zA-Z0-9_-]/) {|c| escape_char c}
  return out
end

def self.quote(str, flags = 0)

Other tags:
    Private: -

Returns:
  • (Regexp) -

Parameters:
  • flags (Fixnum) -- Flags for the created regular expression
  • str (String) -- The text of the regexp
def self.quote(str, flags = 0)
  Regexp.new(Regexp.quote(str), flags)
end