Class: Sass::Tree::IfNode
- Inherits:
- Node
- Object
- Node
- Sass::Tree::IfNode
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/if_node.rb
Overview
Instance Attribute Summary (collapse)
- - (IfNode) else
The next IfNode in the if-else list, or
nil
. - - (Script::Expr) 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. - - (IfNode) initialize(expr) 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
- (IfNode) initialize(expr)
Returns a new instance of IfNode
24 25 26 27 28 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/if_node.rb', line 24
def initialize(expr)
@expr = expr
@last_else = self
super()
end |
Instance Attribute Details
- (IfNode) else
The next Sass::Tree::IfNode in the if-else list, or nil
.
21 22 23 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/if_node.rb', line 21
def else
@else
end |
- (Script::Expr) expr
The conditional expression. If this is nil, this is an @else
node, not an @else if
.
16 17 18 | # File '/Users/ceppstei/Projects/sass-lang/.sass/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 '/Users/ceppstei/Projects/sass-lang/.sass/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 '/Users/ceppstei/Projects/sass-lang/.sass/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 '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/if_node.rb', line 33
def add_else(node)
@last_else.else = node
@last_else = node
end |