class Sass::Script::String
A SassScript object representing a CSS string or a CSS identifier.
def initialize(value, type = :identifier)
-
type
(Symbol
) -- See \{#type} -
value
(String
) -- See \{#value}
def initialize(value, type = :identifier) super(value) @type = type end
def plus(other)
- See: Literal#plus -
def plus(other) other_str = other.is_a?(Sass::Script::String) ? other.value : other.to_s Sass::Script::String.new(self.value + other_str, self.type) end
def to_s(opts = {})
- See: Node#to_s -
def to_s(opts = {}) if @type == :identifier return @value.tr("\n", " ") end return "\"#{value.gsub('"', "\\\"")}\"" if opts[:quote] == %q{"} return "'#{value.gsub("'", "\\'")}'" if opts[:quote] == %q{'} return "\"#{value}\"" unless value.include?('"') return "'#{value}'" unless value.include?("'") "\"#{value.gsub('"', "\\\"")}\"" #' end
def to_sass(opts = {})
- See: Node#to_sass -
def to_sass(opts = {}) to_s end