In addition to setting the {#context} of the string, this sets the string to be an identifier if the context is `:equals`.
@see Node#context=
# File lib/sass/script/string.rb, line 22 22: def context=(context) 23: super 24: @type = :identifier if context == :equals 25: end
@see Literal#plus
# File lib/sass/script/string.rb, line 37 37: def plus(other) 38: other_str = other.is_a?(Sass::Script::String) ? other.value : other.to_s 39: Sass::Script::String.new(self.value + other_str, self.type) 40: end
@see Node#to_s
# File lib/sass/script/string.rb, line 43 43: def to_s(opts = {}) 44: if self.type == :identifier 45: return %{""} if context == :equals && self.value.size == 0 46: return self.value.gsub("\n", " ") 47: end 48: 49: return "\"#{value.gsub('"', "\\\"")}\"" if opts[:quote] == %{"} 50: return "'#{value.gsub("'", "\\'")}'" if opts[:quote] == %{'} 51: return "\"#{value}\"" unless value.include?('"') 52: return "'#{value}'" unless value.include?("'") 53: "\"#{value.gsub('"', "\\\"")}\"" #' 54: end
@see Node#to_sass
# File lib/sass/script/string.rb, line 57 57: def to_sass(opts = {}) 58: if self.type == :identifier && context == :equals && 59: self.value !~ Sass::SCSS::RX::URI && 60: Sass::SCSS::RX.escape_ident(self.value).include?(\\\) 61: return "unquote(#{Sass::Script::String.new(self.value, :string).to_sass})" 62: else 63: return to_s 64: end 65: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.