Class | Sass::Tree::ExtendNode
In: | lib/sass/tree/extend_node.rb
Parent: | Node

A static node reprenting an `@extend` directive.

@see Sass::Tree

### Methods

cssize new perform! to_src

### Public Class methods

new(selector)

@param selector [Array<String, Sass::Script::Node>]

      The CSS selector to extend,
      interspersed with {Sass::Script::Node}s
      representing `#{}`-interpolation.

[Source]

        # File lib/sass/tree/extend_node.rb, line 12
    12:     def initialize(selector)
    13:       @selector = selector
    14:       super()
    15:     end

### Public Instance methods

cssize(extends, parent)

Registers this extension in the `extends` subset map.

@param extends [Haml::Util::SubsetMap{Selector::Simple => Selector::Sequence}]

      The extensions defined for this tree

@param parent [RuleNode] The parent node of this node @see Node#cssize

[Source]

        # File lib/sass/tree/extend_node.rb, line 23
    23:     def cssize(extends, parent)
    24:       @resolved_selector.members.each do |seq|
    25:         if seq.members.size > 1
    26:           raise Sass::SyntaxError.new("Can't extend #{seq.to_a.join}: can't extend nested selectors")
    27:         end
    28:
    29:         sseq = seq.members.first
    30:         if !sseq.is_a?(Sass::Selector::SimpleSequence)
    31:           raise Sass::SyntaxError.new("Can't extend #{seq.to_a.join}: invalid selector")
    32:         end
    33:
    34:         sel = sseq.members
    35:         parent.resolved_rules.members.each do |seq|
    36:           if !seq.members.last.is_a?(Sass::Selector::SimpleSequence)
    37:             raise Sass::SyntaxError.new("#{seq} can't extend: invalid selector")
    38:           end
    39:
    40:           extends[sel] = seq
    41:         end
    42:       end
    43:
    44:       []
    45:     end

### Protected Instance methods

perform!(environment)

Runs SassScript interpolation in the selector, and then parses the result into a {Sass::Selector::CommaSequence}.

@param environment [Sass::Environment] The lexical environment containing

      variable and mixin values

[Source]

        # File lib/sass/tree/extend_node.rb, line 59
    59:     def perform!(environment)
    60:       @resolved_selector = Sass::SCSS::CssParser.new(run_interp(@selector, environment), self.line).
    61:         parse_selector(self.filename)
    62:       super
    63:     end

to_src(tabs, opts, fmt)

@see Node#to_src

[Source]

        # File lib/sass/tree/extend_node.rb, line 50
    50:     def to_src(tabs, opts, fmt)
    51:       "#{'  ' * tabs}@extend #{selector_to_src(@selector, tabs, opts, fmt).lstrip}#{semi fmt}\n"
    52:     end

[Validate]