Class: Sass::Selector::Parent

Inherits:
Simple
  • Object
show all
Defined in:
lib/sass/selector.rb

Overview

A parent-referencing selector (& in Sass). The function of this is to be replaced by the parent selector in the nested hierarchy.

Instance Attribute Summary collapse

Attributes inherited from Simple

#filename, #line

Instance Method Summary collapse

Methods inherited from Simple

#eql?, #equality_key, #hash, #inspect, #to_s, #unify_namespaces

Constructor Details

#initialize(suffix = []) ⇒ Parent

Returns a new instance of Parent.

Parameters:



36
37
38
# File 'lib/sass/selector.rb', line 36

def initialize(suffix = [])
  @suffix = suffix
end

Instance Attribute Details

#suffixArray<String, Sass::Script::Tree::Node> (readonly)

The identifier following the &. Often empty.

Returns:



33
34
35
# File 'lib/sass/selector.rb', line 33

def suffix
  @suffix
end

Instance Method Details

#to_a

See Also:

  • Selector#to_a


41
42
43
# File 'lib/sass/selector.rb', line 41

def to_a
  ["&", *@suffix]
end

#unify(sels)

Always raises an exception.

Raises:

See Also:

  • Selector#unify


49
50
51
# File 'lib/sass/selector.rb', line 49

def unify(sels)
  raise Sass::SyntaxError.new("[BUG] Cannot unify parent selectors.")
end