Class: Sass::Script::Tree::Node
- Inherits:
- Object
- Object
- Sass::Script::Tree::Node
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb
Overview
The abstract superclass for SassScript parse tree nodes.
Use #perform to evaluate a parse tree.
Direct Known Subclasses
Funcall, Interpolation, ListLiteral, Literal, MapLiteral, Operation, Selector, StringInterpolation, UnaryOperation, Variable
Instance Attribute Summary (collapse)
- - (Sass::Script::CssVariableWarning) css_variable_warning
The warning that this node should emit if it executes in a way that’s not safe for a CSS variable value.
- - (String) filename
The file name of the document on which this node appeared.
- - (Fixnum) line
The line of the document on which this node appeared.
- - ({Symbol => Object}) options
The options hash for this node.
- - (Sass::Source::Range) source_range
The source range in the document on which this node appeared.
Instance Method Summary (collapse)
- - (Sass::Script::Value) _perform(environment) protected
Evaluates this node.
- - (Array<Node>) children
Returns all child nodes of this node.
- - dasherize(s, opts) protected
Converts underscores to dashes if the :dasherize option is set.
- - (Node) deep_copy
Returns a deep clone of this node.
- - force_division!
Forces any division operations with number literals in this expression to do real division, rather than returning strings.
- - (Sass::Script::Value) opts(value) protected
Sets the #options field on the given value and returns it.
- - (Sass::Script::Value) perform(environment)
Evaluates the node.
- - (String) to_sass(opts = {})
Returns the text of this SassScript expression.
Instance Attribute Details
- (Sass::Script::CssVariableWarning) css_variable_warning
The warning that this node should emit if it executes in a way that’s not safe for a CSS variable value.
This is nil
if this is not in a CSS variable value.
32 33 34 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 32
def css_variable_warning
@css_variable_warning
end |
- (String) filename
The file name of the document on which this node appeared.
24 25 26 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 24
def filename
@filename
end |
- (Fixnum) line
The line of the document on which this node appeared.
14 15 16 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 14
def line
@line
end |
- ({Symbol => Object}) options
The options hash for this node.
9 10 11 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 9
def options
@options
end |
- (Sass::Source::Range) source_range
The source range in the document on which this node appeared.
19 20 21 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 19
def source_range
@source_range
end |
Instance Method Details
- (Sass::Script::Value) _perform(environment) (protected)
114 115 116 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 114
def _perform(environment)
Sass::Util.abstract(self)
end |
- (Array<Node>) children
Returns all child nodes of this node.
67 68 69 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 67
def children
Sass::Util.abstract(self)
end |
- dasherize(s, opts) (protected)
Converts underscores to dashes if the :dasherize option is set.
99 100 101 102 103 104 105 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 99
def dasherize(s, opts)
if opts[:dasherize]
s.tr('_', '-')
else
s
end
end |
- (Node) deep_copy
Returns a deep clone of this node. The child nodes are cloned, but options are not.
86 87 88 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 86
def deep_copy
Sass::Util.abstract(self)
end |
- force_division!
Forces any division operations with number literals in this expression to do real division, rather than returning strings.
92 93 94 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 92
def force_division!
children.each {|c| c.force_division!}
end |
- (Sass::Script::Value) opts(value) (protected)
Sets the #options field on the given value and returns it.
122 123 124 125 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 122
def opts(value)
value.options = options
value
end |
- (Sass::Script::Value) perform(environment)
57 58 59 60 61 62 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 57
def perform(environment)
_perform(environment)
rescue Sass::SyntaxError => e
e.modify_backtrace(:line => line)
raise e
end |
- (String) to_sass(opts = {})
Returns the text of this SassScript expression.
78 79 80 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/script/tree/node.rb', line 78
def to_sass(opts = {})
Sass::Util.abstract(self)
end |