Class: Sass::Tree::IfNode
- Inherits:
-
Node
- Object
- Node
- Sass::Tree::IfNode
- Defined in:
- .ruby-sass/lib/sass/tree/if_node.rb
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) ⇒ Object
-
#add_else(node) ⇒ Object
Append an `@else` node to the end of the list.
-
#initialize(expr) ⇒ IfNode
constructor
A new instance of IfNode.
Methods inherited from Node
#<<, #==, #bubbles?, #css, #css_with_sourcemap, #deep_copy, #each, inherited, #inspect, #invisible?, #style, #to_sass, #to_scss
Constructor Details
#initialize(expr) ⇒ IfNode
Returns a new instance of IfNode
24 25 26 27 28 |
# File '.ruby-sass/lib/sass/tree/if_node.rb', line 24 def initialize(expr) @expr = expr @last_else = self super() end |
Constructor Details
#initialize(expr) ⇒ IfNode
Returns a new instance of IfNode
24 25 26 27 28 |
# File '.ruby-sass/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 '.ruby-sass/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 '.ruby-sass/lib/sass/tree/if_node.rb', line 16 def expr @expr end |
Class Method Details
._load(data) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File '.ruby-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) ⇒ Object
38 39 40 |
# File '.ruby-sass/lib/sass/tree/if_node.rb', line 38 def _dump(f) Marshal.dump([expr, self.else, children]) end |
#add_else(node) ⇒ Object
Append an `@else` node to the end of the list.
33 34 35 36 |
# File '.ruby-sass/lib/sass/tree/if_node.rb', line 33 def add_else(node) @last_else.else = node @last_else = node end |