class Sass::Value::List
Sass’s list type.
def ==(other)
def ==(other) (other.is_a?(Sass::Value::List) && other.contents == contents && other.separator == separator && other.bracketed? == bracketed?) || (to_a.empty? && other.is_a?(Sass::Value::Map) && other.to_a.empty?) end
def assert_map(name = nil)
def assert_map(name = nil) to_a.empty? ? Sass::Value::Map.new({}) : super.assert_map(name) end
def at(index)
def at(index) index = index.floor index = to_a.length + index if index.negative? return nil if index.negative? || index >= to_a.length to_a[index] end
def bracketed?
def bracketed? @bracketed end
def hash
def hash @hash ||= contents.hash end
def initialize(contents = [], separator: ',', bracketed: false) # rubocop:disable Lint/MissingSuper
def initialize(contents = [], separator: ',', bracketed: false) # rubocop:disable Lint/MissingSuper if separator.nil? && contents.length > 1 raise error 'A list with more than one element must have an explicit separator' end @contents = contents.freeze @separator = separator.freeze @bracketed = bracketed.freeze end
def to_a_length
def to_a_length to_a.length end
def to_map
def to_map to_a.empty? ? Sass::Value::Map.new({}) : nil end