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