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
- #group_end
-
#query ⇒ Array<String, Sass::Script::Node>
The media query for this rule, interspersed with Script::Nodes representing
#{}
-interpolation. -
#resolved_query ⇒ Sass::Media::QueryList
The media query for this rule, without any unresolved interpolation.
- #tabs
Attributes inherited from Node
#children, #filename, #has_children, #line, #options
Instance Method Summary collapse
- #bubbles? ⇒ Boolean
-
#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
Methods inherited from Node
#<<, #==, #balance, #deep_copy, #each, #inspect, #style, #to_s, #to_sass, #to_scss
Constructor Details
#initialize(query) ⇒ MediaNode
Returns a new instance of MediaNode.
31 32 33 34 35 |
# File 'lib/sass/tree/media_node.rb', line 31
def initialize(query)
@query = query
@tabs = 0
super('')
end
|
Instance Attribute Details
#group_end
28 29 30 |
# File 'lib/sass/tree/media_node.rb', line 28
def group_end
@group_end
end
|
#query ⇒ Array<String, Sass::Script::Node>
The media query for this rule, interspersed with Script::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 Tree::Node#perform has been called.
22 23 24 |
# File 'lib/sass/tree/media_node.rb', line 22
def resolved_query
@resolved_query
end
|
#tabs
25 26 27 |
# File 'lib/sass/tree/media_node.rb', line 25
def tabs
@tabs
end
|
Instance Method Details
#bubbles? ⇒ Boolean
56 |
# File 'lib/sass/tree/media_node.rb', line 56
def bubbles?; true; end
|
#invisible? ⇒ Boolean
True when the directive has no visible children.
51 52 53 |
# File 'lib/sass/tree/media_node.rb', line 51
def invisible?
children.all? {|c| c.invisible?}
end
|
#name
41 |
# File 'lib/sass/tree/media_node.rb', line 41
def name; '@media'; end
|
#resolved_value
44 45 46 |
# File 'lib/sass/tree/media_node.rb', line 44
def resolved_value
@resolved_value ||= "@media #{resolved_query.to_css}"
end
|
#value
38 |
# File 'lib/sass/tree/media_node.rb', line 38
def value; raise NotImplementedError; end
|