Class: Sass::Tree::DirectiveNode
- Inherits:
- Node
- Object
- Node
- Sass::Tree::DirectiveNode
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/directive_node.rb
Overview
A static node representing an unprocessed 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)
- - group_end
- - (String) resolved_value
The text of the directive after any interpolated SassScript has been resolved.
- - tabs
- - (Array<String, Sass::Script::Tree::Node>) value
The text of the directive,
@
and all, with interpolation included.
Attributes inherited from Node
#children, #filename, #has_children, #line, #options, #source_range
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Boolean) bubbles?
- - (DirectiveNode) initialize(value) constructor
A new instance of DirectiveNode.
- - (String) name
The name of the directive, including
@
. - - (String) normalized_name
Strips out any vendor prefixes and downcases the directive name.
Methods inherited from Node
#<<, #==, #balance, #css, #css_with_sourcemap, #deep_copy, #each, #inspect, #invisible?, #style, #to_sass, #to_scss
Constructor Details
- (DirectiveNode) initialize(value)
Returns a new instance of DirectiveNode
30 31 32 33 34 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/directive_node.rb', line 30
def initialize(value)
@value = value
@tabs = 0
super()
end |
Instance Attribute Details
- group_end
27 28 29 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/directive_node.rb', line 27
def group_end
@group_end
end |
- (String) resolved_value
The text of the directive after any interpolated SassScript has been resolved. Only set once Visitors::Perform has been run.
21 22 23 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/directive_node.rb', line 21
def resolved_value
@resolved_value
end |
- tabs
24 25 26 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/directive_node.rb', line 24
def tabs
@tabs
end |
- (Array<String, Sass::Script::Tree::Node>) value
The text of the directive, @
and all, with interpolation included.
15 16 17 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/directive_node.rb', line 15
def value
@value
end |
Class Method Details
+ (DirectiveNode) resolved(value)
38 39 40 41 42 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/directive_node.rb', line 38
def self.resolved(value)
node = new([value])
node.resolved_value = value
node
end |
Instance Method Details
- (Boolean) bubbles?
55 56 57 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/directive_node.rb', line 55
def bubbles?
has_children
end |
- (String) name
Returns The name of the directive, including @
.
45 46 47 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/directive_node.rb', line 45
def name
@name ||= value.first.gsub(/ .*$/, '')
end |
- (String) normalized_name
Strips out any vendor prefixes and downcases the directive name.
51 52 53 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/directive_node.rb', line 51
def normalized_name
@normalized_name ||= name.gsub(/^(@)(?:-[a-zA-Z0-9]+-)?/, '\1').downcase
end |