File: trace_node.rb

package info (click to toggle)
ruby-sass 3.7.4-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,396 kB
  • sloc: ruby: 32,443; sh: 26; makefile: 25
file content (33 lines) | stat: -rw-r--r-- 895 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'sass/tree/node'

module Sass::Tree
  # A solely static node left over after a mixin include or @content has been performed.
  # Its sole purpose is to wrap exceptions to add to the backtrace.
  #
  # @see Sass::Tree
  class TraceNode < Node
    # The name of the trace entry to add.
    #
    # @return [String]
    attr_reader :name

    # @param name [String] The name of the trace entry to add.
    def initialize(name)
      @name = name
      self.has_children = true
      super()
    end

    # Initializes this node from an existing node.
    # @param name [String] The name of the trace entry to add.
    # @param node [Node] The node to copy information from.
    # @return [TraceNode]
    def self.from_node(name, node)
      trace = new(name)
      trace.line = node.line
      trace.filename = node.filename
      trace.options = node.options
      trace
    end
  end
end