Class: Sass::Tree::DebugNode

Inherits:
Node
  • Object
show all
Defined in:
lib/sass/tree/debug_node.rb

Overview

A dynamic node representing a Sass @debug statement.

See Also:

Instance Attribute Summary

Attributes inherited from Node

#children, #filename, #has_children, #line, #options

Instance Method Summary collapse

Methods inherited from Node

#<<, #==, #_cssize, #_to_s, #balance, #check_child!, #children_to_src, #cssize, #cssize!, #dasherize, #do_extend, #each, #invalid_child?, #invisible?, #perform, #perform!, #perform_children, #render, #run_interp, #semi, #style, #to_s, #to_sass, #to_scss

Constructor Details

#initialize(expr) ⇒ DebugNode

Returns a new instance of DebugNode.

Parameters:



8
9
10
11
# File 'lib/sass/tree/debug_node.rb', line 8

def initialize(expr)
  @expr = expr
  super()
end

Instance Method Details

#_perform(environment) (protected)

Prints the expression to STDERR.

Parameters:

  • environment (Sass::Environment)

    The lexical environment containing variable and mixin values



24
25
26
27
28
29
30
31
32
33
# File 'lib/sass/tree/debug_node.rb', line 24

def _perform(environment)
  res = @expr.perform(environment)
  res = res.value if res.is_a?(Sass::Script::String)
  if filename
    $stderr.puts "#{filename}:#{line} DEBUG: #{res}"
  else
    $stderr.puts "Line #{line} DEBUG: #{res}"
  end
  []
end

#to_src(tabs, opts, fmt) (protected)

See Also:



16
17
18
# File 'lib/sass/tree/debug_node.rb', line 16

def to_src(tabs, opts, fmt)
  "#{'  ' * tabs}@debug #{@expr.to_sass(opts)}#{semi fmt}\n"
end