Class Index [+]

Quicksearch

Sass::Tree::MixinDefNode

A dynamic node representing a mixin definition.

@see Sass::Tree

Public Class Methods

new(name, args) click to toggle source

@param name [String] The mixin name @param args [Array<(Script::Node, Script::Node)>] The arguments for the mixin.

  Each element is a tuple containing the variable for argument
  and the parse tree for the default value of the argument
    # File lib/sass/tree/mixin_def_node.rb, line 11
11:       def initialize(name, args)
12:         @name = name
13:         @args = args
14:         super()
15:       end

Protected Instance Methods

_perform(environment) click to toggle source

Loads the mixin into the environment.

@param environment [Sass::Environment] The lexical environment containing

  variable and mixin values
    # File lib/sass/tree/mixin_def_node.rb, line 42
42:       def _perform(environment)
43:         environment.set_mixin(@name, Sass::Mixin.new(@name, @args, environment, children))
44:         []
45:       end
invalid_child?(child) click to toggle source

Returns an error message if the given child node is invalid, and false otherwise.

{ExtendNode}s are valid within {MixinDefNode}s.

@param child [Tree::Node] A potential child node. @return [Boolean, String] Whether or not the child node is valid,

  as well as the error message to display if it is invalid
    # File lib/sass/tree/mixin_def_node.rb, line 55
55:       def invalid_child?(child)
56:         super unless child.is_a?(ExtendNode)
57:       end
to_src(tabs, opts, fmt) click to toggle source

@see Node#to_src

    # File lib/sass/tree/mixin_def_node.rb, line 20
20:       def to_src(tabs, opts, fmt)
21:         args =
22:           if @args.empty?
23:             ""
24:           else
25:             '(' + @args.map do |v, d|
26:               if d
27:                 "#{v.to_sass(opts)}: #{d.to_sass(opts)}"
28:               else
29:                 v.to_sass(opts)
30:               end
31:             end.join(", ") + ')'
32:           end
33:               
34:         "#{'  ' * tabs}#{fmt == :sass ? '=' : '@mixin '}#{dasherize(@name, opts)}#{args}" +
35:           children_to_src(tabs, opts, fmt)
36:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.