Class: CssCompare::CSS::Value::ListLiteral

Inherits:
Base
  • Object
show all
Defined in:
lib/css_compare/css/value/list_literal.rb

Overview

Wraps the SassScript ListLiteral object.

Instance Attribute Summary

Attributes inherited from Base

#value

Instance Method Summary collapse

Methods inherited from Base

#color?, #equals?, #important?, #initialize, #to_s

Constructor Details

This class inherits a constructor from CssCompare::CSS::Value::Base

Instance Method Details

#==(other) ⇒ Boolean

Checks, whether two list literals are equal.

Parameters:

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/css_compare/css/value/list_literal.rb', line 11

def ==(other)
  return false unless super
  elements1 = @value.elements.length
  elements2 = other.value.elements.length
  return false unless elements1 == elements2
  @value.elements.each_index do |i|
    value1 = sanitize_string(@value.elements[i].to_sass)
    value2 = sanitize_string(other.value.elements[i].to_sass)
    return false unless value1 == value2
  end
  true
end