Class: Sass::Tree::DirectiveNode
- Defined in:
- lib/sass/tree/directive_node.rb
Overview
A static node representing an unproccessed Sass @
-directive.
Directives known to Sass, like @for
and @debug
,
are handled by their own nodes;
only CSS directives like @media
and @font-face
become DirectiveNodes.
@import
and @charset
are special cases;
they become ImportNodes and CharsetNodes, respectively.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#resolved_value ⇒ String
The text of the directive after any interpolated SassScript has been resolved.
-
#value ⇒ Array<String, Sass::Script::Node>
The text of the directive,
@
and all, with interpolation included.
Attributes inherited from Node
#children, #filename, #has_children, #line, #options
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value) ⇒ DirectiveNode
constructor
A new instance of DirectiveNode.
-
#name ⇒ String
The name of the directive, including
@
.
Methods inherited from Node
#<<, #==, #balance, #bubbles?, #deep_copy, #each, #inspect, #invisible?, #style, #to_s, #to_sass, #to_scss
Constructor Details
#initialize(value) ⇒ DirectiveNode
Returns a new instance of DirectiveNode.
24 25 26 27 |
# File 'lib/sass/tree/directive_node.rb', line 24
def initialize(value)
@value = value
super()
end
|
Instance Attribute Details
#resolved_value ⇒ String
The text of the directive after any interpolated SassScript has been resolved. Only set once Visitors::Perform has been run.
21 22 23 |
# File 'lib/sass/tree/directive_node.rb', line 21
def resolved_value
@resolved_value
end
|
#value ⇒ Array<String, Sass::Script::Node>
The text of the directive, @
and all, with interpolation included.
15 16 17 |
# File 'lib/sass/tree/directive_node.rb', line 15
def value
@value
end
|
Class Method Details
.resolved(value) ⇒ DirectiveNode
31 32 33 34 35 |
# File 'lib/sass/tree/directive_node.rb', line 31
def self.resolved(value)
node = new([value])
node.resolved_value = value
node
end
|
Instance Method Details
#name ⇒ String
Returns The name of the directive, including @
.
38 39 40 |
# File 'lib/sass/tree/directive_node.rb', line 38
def name
value.first.gsub(/ .*$/, '')
end
|