class Sass::Tree::Visitors::SetOptions - sass-3.2.19 Documentation

# class Sass::Tree::Visitors::SetOptions

A visitor for setting options on the Sass tree

### Public Class Methods

new(options) click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 9
    def initialize(options)
      @options = options
    end

visit(root, options) click to toggle source

@param root [Tree::Node] The root node of the tree to visit. @param options [{Symbol => Object}] The options has to set.

    # File lib/sass/tree/visitors/set_options.rb, line 5
    def self.visit(root, options); new(options).send(:visit, root); end

### Protected Instance Methods

visit(node) click to toggle source
Calls superclass method Sass::Tree::Visitors::Base.visit

    # File lib/sass/tree/visitors/set_options.rb, line 13
    def visit(node)
      node.instance_variable_set('@options', @options)
      super
    end

visit_cssimport(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 116
    def visit_cssimport(node)
      node.query.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)} if node.query
      yield
    end

visit_debug(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 18
    def visit_debug(node)
      node.expr.options = @options
      yield
    end

visit_directive(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 106
    def visit_directive(node)
      node.value.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)}
      yield
    end

visit_each(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 23
    def visit_each(node)
      node.list.options = @options
      yield
    end

visit_extend(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 28
    def visit_extend(node)
      node.selector.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)}
      yield
    end

visit_for(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 33
    def visit_for(node)
      node.from.options = @options
      node.to.options = @options
      yield
    end

visit_function(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 39
    def visit_function(node)
      node.args.each do |k, v|
        k.options = @options
        v.options = @options if v
      end
      yield
    end

visit_if(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 47
    def visit_if(node)
      node.expr.options = @options if node.expr
      visit(node.else) if node.else
      yield
    end

visit_import(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 53
    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

visit_media(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 111
    def visit_media(node)
      node.query.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)}
      yield
    end

visit_mixin(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 69
    def visit_mixin(node)
      node.args.each {|a| a.options = @options}
      node.keywords.each {|k, v| v.options = @options}
      yield
    end

visit_mixindef(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 61
    def visit_mixindef(node)
      node.args.each do |k, v|
        k.options = @options
        v.options = @options if v
      end
      yield
    end

visit_prop(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 75
    def visit_prop(node)
      node.name.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)}
      node.value.options = @options
      yield
    end

visit_return(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 81
    def visit_return(node)
      node.expr.options = @options
      yield
    end

visit_rule(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 86
    def visit_rule(node)
      node.rule.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)}
      yield
    end

visit_supports(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 121
    def visit_supports(node)
      node.condition.options = @options
      yield
    end

visit_variable(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 91
    def visit_variable(node)
      node.expr.options = @options
      yield
    end

visit_warn(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 96
    def visit_warn(node)
      node.expr.options = @options
      yield
    end

visit_while(node) { || ... } click to toggle source

    # File lib/sass/tree/visitors/set_options.rb, line 101
    def visit_while(node)
      node.expr.options = @options
      yield
    end