Method: Sass::Script::Functions#append
- Defined in:
- lib/sass/script/functions.rb
#append($list, $val, $separator: auto) ⇒ Sass::Script::Value::List
Appends a single value onto the end of a list.
Unless the $separator argument is passed, if the list had only one item,
the resulting list will be space-separated.
Like all list functions, append() returns a new list rather than
modifying its argument in place.
2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 |
# File 'lib/sass/script/functions.rb', line 2131
def append(list, val, separator = identifier("auto"))
assert_type separator, :String, :separator
unless %w(auto space comma).include?(separator.value)
raise ArgumentError.new("Separator name must be space, comma, or auto")
end
list.with_contents(list.to_a + [val],
separator:
if separator.value == 'auto'
list.separator || :space
else
separator.value.to_sym
end)
end
|