Class: Sass::Tree::MediaNode
- Inherits:
-
DirectiveNode
- Object
- Node
- DirectiveNode
- Sass::Tree::MediaNode
- Defined in:
- 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
-
#query ⇒ Array<String, Sass::Script::Tree::Node>
The media query for this rule, interspersed with Script::Tree::Nodes representing
#{}
-interpolation. -
#resolved_query ⇒ Sass::Media::QueryList
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
-
#initialize(query) ⇒ MediaNode
constructor
A new instance of MediaNode.
-
#invisible? ⇒ Boolean
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
#initialize(query) ⇒ MediaNode
Returns a new instance of MediaNode.
25 26 27 28 |
# File 'lib/sass/tree/media_node.rb', line 25
def initialize(query)
@query = query
super('')
end
|
Instance Attribute Details
#query ⇒ Array<String, Sass::Script::Tree::Node>
The media query for this rule, interspersed with Script::Tree::Nodes
representing #{}
-interpolation. Any adjacent strings will be merged
together.
16 17 18 |
# File 'lib/sass/tree/media_node.rb', line 16
def query
@query
end
|
#resolved_query ⇒ Sass::Media::QueryList
The media query for this rule, without any unresolved interpolation. It's only set once Visitors::Perform has been run.
22 23 24 |
# File 'lib/sass/tree/media_node.rb', line 22
def resolved_query
@resolved_query
end
|
Instance Method Details
#invisible? ⇒ Boolean
True when the directive has no visible children.
44 45 46 |
# File 'lib/sass/tree/media_node.rb', line 44
def invisible?
children.all? {|c| c.invisible?}
end
|
#name
34 |
# File 'lib/sass/tree/media_node.rb', line 34
def name; '@media'; end
|
#resolved_value
37 38 39 |
# File 'lib/sass/tree/media_node.rb', line 37
def resolved_value
@resolved_value ||= "@media #{resolved_query.to_css}"
end
|
#value
31 |
# File 'lib/sass/tree/media_node.rb', line 31
def value; raise NotImplementedError; end
|