Class: Sass::Tree::MediaNode

Inherits:
DirectiveNode show all
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.

See Also:

Instance Attribute Summary collapse

Attributes inherited from DirectiveNode

#group_end, #tabs

Attributes inherited from Node

#children, #filename, #has_children, #line, #options, #source_range

Instance Method Summary collapse

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.

Parameters:



25
26
27
28
# File 'lib/sass/tree/media_node.rb', line 25

def initialize(query)
  @query = query
  super('')
end

Instance Attribute Details

#queryArray<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.

Returns:



16
17
18
# File 'lib/sass/tree/media_node.rb', line 16

def query
  @query
end

#resolved_querySass::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.

Returns:

  • (Boolean)


44
45
46
# File 'lib/sass/tree/media_node.rb', line 44

def invisible?
  children.all? {|c| c.invisible?}
end

#name

See Also:



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

Raises:

  • (NotImplementedError)

See Also:



31
# File 'lib/sass/tree/media_node.rb', line 31

def value; raise NotImplementedError; end