Class: Sass::Script::Node
- Inherits:
-
Object
- Object
- Sass::Script::Node
- Defined in:
- /var/www/sass-pages/.sass/lib/sass/script/node.rb
Overview
The abstract superclass for SassScript parse tree nodes.
Use #perform to evaluate a parse tree.
Direct Known Subclasses
Funcall, Interpolation, Literal, Operation, StringInterpolation, UnaryOperation, Variable
Instance Attribute Summary
- - (Fixnum) line The line of the document on which this node appeared.
- - ({Symbol => Object}) options The options hash for this node.
Instance Method Summary
- - (Literal) _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.
- - (Literal) opts(literal) protected Sets the #options field on the given literal and returns it.
- - (Literal) perform(environment) Evaluates the node.
- - (String) to_sass(opts = {}) Returns the text of this SassScript expression.
Instance Attribute Details
- (Fixnum) line
The line of the document on which this node appeared.
14 15 16 |
# File '/var/www/sass-pages/.sass/lib/sass/script/node.rb', line 14
def line
@line
end
|
- ({Symbol => Object}) options
The options hash for this node.
9 10 11 |
# File '/var/www/sass-pages/.sass/lib/sass/script/node.rb', line 9
def options
@options
end
|
Instance Method Details
- (Literal) _perform(environment) (protected)
86 87 88 |
# File '/var/www/sass-pages/.sass/lib/sass/script/node.rb', line 86
def _perform(environment)
Sass::Util.abstract(self)
end
|
- (Array<Node>) children
Returns all child nodes of this node.
49 50 51 |
# File '/var/www/sass-pages/.sass/lib/sass/script/node.rb', line 49
def children
Sass::Util.abstract(self)
end
|
- dasherize(s, opts) (protected)
Converts underscores to dashes if the :dasherize option is set.
71 72 73 74 75 76 77 |
# File '/var/www/sass-pages/.sass/lib/sass/script/node.rb', line 71
def dasherize(s, opts)
if opts[:dasherize]
s.gsub(/_/,'-')
else
s
end
end
|
- (Node) deep_copy
Returns a deep clone of this node. The child nodes are cloned, but options are not.
64 65 66 |
# File '/var/www/sass-pages/.sass/lib/sass/script/node.rb', line 64
def deep_copy
Sass::Util.abstract(self)
end
|
- (Literal) opts(literal) (protected)
Sets the #options field on the given literal and returns it
94 95 96 97 |
# File '/var/www/sass-pages/.sass/lib/sass/script/node.rb', line 94
def opts(literal)
literal.options = options
literal
end
|
- (Literal) perform(environment)
39 40 41 42 43 44 |
# File '/var/www/sass-pages/.sass/lib/sass/script/node.rb', line 39
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.
56 57 58 |
# File '/var/www/sass-pages/.sass/lib/sass/script/node.rb', line 56
def to_sass(opts = {})
Sass::Util.abstract(self)
end
|