/usr/lib/ruby/vendor_ruby/sass/tree/visitors/set_options.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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | # A visitor for setting options on the Sass tree
class Sass::Tree::Visitors::SetOptions < Sass::Tree::Visitors::Base
# @param root [Tree::Node] The root node of the tree to visit.
# @param options [{Symbol => Object}] The options has to set.
def self.visit(root, options); new(options).send(:visit, root); end
protected
def initialize(options)
@options = options
end
def visit(node)
node.instance_variable_set('@options', @options)
super
end
def visit_comment(node)
node.value.each {|c| c.options = @options if c.is_a?(Sass::Script::Tree::Node)}
yield
end
def visit_debug(node)
node.expr.options = @options
yield
end
def visit_error(node)
node.expr.options = @options
yield
end
def visit_each(node)
node.list.options = @options
yield
end
def visit_extend(node)
node.selector.each {|c| c.options = @options if c.is_a?(Sass::Script::Tree::Node)}
yield
end
def visit_for(node)
node.from.options = @options
node.to.options = @options
yield
end
def visit_function(node)
node.args.each do |k, v|
k.options = @options
v.options = @options if v
end
node.splat.options = @options if node.splat
yield
end
def visit_if(node)
node.expr.options = @options if node.expr
visit(node.else) if node.else
yield
end
def visit_import(node)
# We have no good way of propagating the new options through an Engine
# instance, so we just null it out. This also lets us avoid caching an
# imported Engine along with the importing source tree.
node.imported_file = nil
yield
end
def visit_mixindef(node)
node.args.each do |k, v|
k.options = @options
v.options = @options if v
end
node.splat.options = @options if node.splat
yield
end
def visit_mixin(node)
node.args.each {|a| a.options = @options}
node.keywords.each {|k, v| v.options = @options}
node.splat.options = @options if node.splat
node.kwarg_splat.options = @options if node.kwarg_splat
yield
end
def visit_prop(node)
node.name.each {|c| c.options = @options if c.is_a?(Sass::Script::Tree::Node)}
node.value.options = @options
yield
end
def visit_return(node)
node.expr.options = @options
yield
end
def visit_rule(node)
node.rule.each {|c| c.options = @options if c.is_a?(Sass::Script::Tree::Node)}
yield
end
def visit_variable(node)
node.expr.options = @options
yield
end
def visit_warn(node)
node.expr.options = @options
yield
end
def visit_while(node)
node.expr.options = @options
yield
end
def visit_directive(node)
node.value.each {|c| c.options = @options if c.is_a?(Sass::Script::Tree::Node)}
yield
end
def visit_media(node)
node.query.each {|c| c.options = @options if c.is_a?(Sass::Script::Tree::Node)}
yield
end
def visit_cssimport(node)
node.query.each {|c| c.options = @options if c.is_a?(Sass::Script::Tree::Node)} if node.query
yield
end
def visit_supports(node)
node.condition.options = @options
yield
end
end
|