class Sass::Tree::Visitors::DeepCopy - sass-3.4.14 Documentation

# class Sass::Tree::Visitors::DeepCopy

A visitor for copying the full structure of a Sass tree.

### Protected Instance Methods

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 5
    def visit(node)
      super(node.dup)
    end

visit_children(parent) click to toggle source

    # File lib/sass/tree/visitors/deep_copy.rb, line 9
    def visit_children(parent)
      parent.children = parent.children.map {|c| visit(c)}
      parent
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 14
    def visit_debug(node)
      node.expr = node.expr.deep_copy
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 93
    def visit_directive(node)
      node.value = node.value.map {|c| c.is_a?(Sass::Script::Tree::Node) ? c.deep_copy : c}
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 24
    def visit_each(node)
      node.list = node.list.deep_copy
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 19
    def visit_error(node)
      node.expr = node.expr.deep_copy
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 29
    def visit_extend(node)
      node.selector = node.selector.map {|c| c.is_a?(Sass::Script::Tree::Node) ? c.deep_copy : c}
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 34
    def visit_for(node)
      node.from = node.from.deep_copy
      node.to = node.to.deep_copy
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 40
    def visit_function(node)
      node.args = node.args.map {|k, v| [k.deep_copy, v && v.deep_copy]}
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 45
    def visit_if(node)
      node.expr = node.expr.deep_copy if node.expr
      node.else = visit(node.else) if node.else
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 98
    def visit_media(node)
      node.query = node.query.map {|c| c.is_a?(Sass::Script::Tree::Node) ? c.deep_copy : c}
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 56
    def visit_mixin(node)
      node.args = node.args.map {|a| a.deep_copy}
      node.keywords = Hash[node.keywords.map {|k, v| [k, v.deep_copy]}]
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 51
    def visit_mixindef(node)
      node.args = node.args.map {|k, v| [k.deep_copy, v && v.deep_copy]}
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 62
    def visit_prop(node)
      node.name = node.name.map {|c| c.is_a?(Sass::Script::Tree::Node) ? c.deep_copy : c}
      node.value = node.value.deep_copy
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 68
    def visit_return(node)
      node.expr = node.expr.deep_copy
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 73
    def visit_rule(node)
      node.rule = node.rule.map {|c| c.is_a?(Sass::Script::Tree::Node) ? c.deep_copy : c}
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 103
    def visit_supports(node)
      node.condition = node.condition.deep_copy
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 78
    def visit_variable(node)
      node.expr = node.expr.deep_copy
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 83
    def visit_warn(node)
      node.expr = node.expr.deep_copy
      yield
    end

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

    # File lib/sass/tree/visitors/deep_copy.rb, line 88
    def visit_while(node)
      node.expr = node.expr.deep_copy
      yield
    end