Class: Sass::Tree::MediaNode
- Inherits:
- DirectiveNode
- Object
- Node
- DirectiveNode
- Sass::Tree::MediaNode
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/media_node.rb
Overview
A static node representing a @media
rule. @media
rules behave differently from other directives in that when they’re nested within rules, they bubble up to top-level.
Instance Attribute Summary (collapse)
- - (Array<String, Sass::Script::Tree::Node>) query
The media query for this rule, interspersed with Script::Tree::Nodes representing
#{}
-interpolation. - - (Sass::Media::QueryList) resolved_query
The media query for this rule, without any unresolved interpolation.
Attributes inherited from DirectiveNode
Attributes inherited from Node
#children, #filename, #has_children, #line, #options, #source_range
Instance Method Summary (collapse)
- - (MediaNode) initialize(query) constructor
A new instance of MediaNode.
- - (Boolean) invisible?
True when the directive has no visible children.
- - name
- - resolved_value
- - value
Methods inherited from DirectiveNode
#bubbles?, #normalized_name, resolved
Methods inherited from Node
#<<, #==, #balance, #bubbles?, #css, #css_with_sourcemap, #deep_copy, #each, #inspect, #style, #to_sass, #to_scss
Constructor Details
- (MediaNode) initialize(query)
Returns a new instance of MediaNode
25 26 27 28 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/media_node.rb', line 25
def initialize(query)
@query = query
super('')
end |
Instance Attribute Details
- (Array<String, Sass::Script::Tree::Node>) query
The media query for this rule, interspersed with Script::Tree::Nodes representing #{}
-interpolation. Any adjacent strings will be merged together.
16 17 18 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/media_node.rb', line 16
def query
@query
end |
- (Sass::Media::QueryList) resolved_query
The media query for this rule, without any unresolved interpolation. It’s only set once Visitors::Perform has been run.
22 23 24 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/media_node.rb', line 22
def resolved_query
@resolved_query
end |
Instance Method Details
- (Boolean) invisible?
True when the directive has no visible children.
44 45 46 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/media_node.rb', line 44
def invisible?
children.all? {|c| c.invisible?}
end |
- name
34 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/media_node.rb', line 34
def name; '@media'; end |
- resolved_value
37 38 39 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/media_node.rb', line 37
def resolved_value
@resolved_value ||= "@media #{resolved_query.to_css}"
end |
- value
31 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/media_node.rb', line 31
def value; raise NotImplementedError; end |