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, #unify_namespaces, #unique?

Constructor Details

#initialize(suffix = nil) ⇒ Parent

Returns a new instance of Parent.

Parameters:

  • name (String, nil)

    See #suffix



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

def initialize(suffix = nil)
  @suffix = suffix
end

Instance Attribute Details

#suffixString? (readonly)

The identifier following the &. nil indicates no suffix.

Returns:

  • (String, nil)


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

def suffix
  @suffix
end

Instance Method Details

#to_s(opts = {})

See Also:

  • Selector#to_s


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

def to_s(opts = {})
  "&" + (@suffix || '')
end

#unify(sels)

Always raises an exception.

Raises:

See Also:

  • Selector#unify


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

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