/usr/lib/ruby/vendor_ruby/sass/tree/if_node.rb is in ruby-sass 3.4.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | require 'sass/tree/node'
module Sass::Tree
# A dynamic node representing a Sass `@if` statement.
#
# {IfNode}s are a little odd, in that they also represent `@else` and `@else if`s.
# This is done as a linked list:
# each {IfNode} has a link (\{#else}) to the next {IfNode}.
#
# @see Sass::Tree
class IfNode < Node
# The conditional expression.
# If this is nil, this is an `@else` node, not an `@else if`.
#
# @return [Script::Expr]
attr_accessor :expr
# The next {IfNode} in the if-else list, or `nil`.
#
# @return [IfNode]
attr_accessor :else
# @param expr [Script::Expr] See \{#expr}
def initialize(expr)
@expr = expr
@last_else = self
super()
end
# Append an `@else` node to the end of the list.
#
# @param node [IfNode] The `@else` node to append
def add_else(node)
@last_else.else = node
@last_else = node
end
def _dump(f)
Marshal.dump([expr, self.else, children])
end
def self._load(data)
expr, else_, children = Marshal.load(data)
node = IfNode.new(expr)
node.else = else_
node.children = children
node.instance_variable_set('@last_else',
node.else ? node.else.instance_variable_get('@last_else') : node)
node
end
end
end
|