class Sass::Script::Value::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: Value#plus -
def plus(other) other_str = other.is_a?(Sass::Script::Value::String) ? other.value : other.to_s Sass::Script::Value::String.new(value + other_str, type) end
def to_s(opts = {})
- See: Value#to_s -
def to_s(opts = {}) if @type == :identifier return @value.gsub(/\n\s*/, " ") 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: Value#to_sass -
def to_sass(opts = {}) to_s end