Class: Sass::Tree::IfNode
Overview
Instance Attribute Summary collapse
-
#else ⇒ IfNode
The next IfNode in the if-else list, or
nil
. -
#expr ⇒ Script::Expr
The conditional expression.
Attributes inherited from Node
#children, #filename, #has_children, #line, #options, #source_range
Class Method Summary collapse
Instance Method Summary collapse
- #_dump(f)
-
#add_else(node)
Append an
@else
node to the end of the list. -
#initialize(expr) ⇒ IfNode
constructor
A new instance of IfNode.
Methods inherited from Node
#<<, #==, #balance, #bubbles?, #css, #css_with_sourcemap, #deep_copy, #each, #inspect, #invisible?, #style, #to_sass, #to_scss
Constructor Details
#initialize(expr) ⇒ IfNode
Returns a new instance of IfNode.
24 25 26 27 28 |
# File 'lib/sass/tree/if_node.rb', line 24
def initialize(expr)
@expr = expr
@last_else = self
super()
end
|
Instance Attribute Details
#else ⇒ IfNode
The next Sass::Tree::IfNode in the if-else list, or nil
.
21 22 23 |
# File 'lib/sass/tree/if_node.rb', line 21
def else
@else
end
|
#expr ⇒ Script::Expr
The conditional expression.
If this is nil, this is an @else
node, not an @else if
.
16 17 18 |
# File 'lib/sass/tree/if_node.rb', line 16
def expr
@expr
end
|
Class Method Details
._load(data)
42 43 44 45 46 47 48 49 50 |
# File 'lib/sass/tree/if_node.rb', line 42
def self._load(data)
expr, else_, children = Marshal.load(data)
node = IfNode.new(expr)
node.else = else_
node.children = children
node.instance_variable_set('@last_else',
node.else ? node.else.instance_variable_get('@last_else') : node)
node
end
|
Instance Method Details
#_dump(f)
38 39 40 |
# File 'lib/sass/tree/if_node.rb', line 38
def _dump(f)
Marshal.dump([expr, self.else, children])
end
|
#add_else(node)
Append an @else
node to the end of the list.
33 34 35 36 |
# File 'lib/sass/tree/if_node.rb', line 33
def add_else(node)
@last_else.else = node
@last_else = node
end
|