class Sass::Value::String
@see sass-lang.com/documentation/js-api/classes/sassstring/
Sass’s string type.
def ==(other)
-
(::Boolean)
-
def ==(other) other.is_a?(Sass::Value::String) && other.text == text end
def assert_calculation_value(name = nil)
-
(ScriptError)
-
Returns:
-
(CalculationValue)
-
def assert_calculation_value(name = nil) raise Sass::ScriptError.new("Expected #{self} to be an unquoted string.", name) if quoted? self end
def assert_string(_name = nil)
-
(String)
-
def assert_string(_name = nil) self end
def hash
-
(Integer)
-
def hash @hash ||= text.hash end
def initialize(text = '', quoted: true)
-
quoted
(::Boolean
) -- -
text
(::String
) --
def initialize(text = '', quoted: true) @text = text.freeze @quoted = quoted end
def quoted?
-
(::Boolean)
-
def quoted? @quoted end
def sass_index_to_string_index(sass_index, name = nil)
-
(Integer)
-
Parameters:
-
sass_index
(Number
) --
def sass_index_to_string_index(sass_index, name = nil) index = sass_index.assert_number(name).assert_integer(name) raise Sass::ScriptError.new('String index may not be 0', name) if index.zero? if index.abs > text.length raise Sass::ScriptError.new("Invalid index #{sass_index} for a string with #{text.length} characters", name) end index.negative? ? text.length + index : index - 1 end