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 Node

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

Instance Method Summary collapse

Methods inherited from DirectiveNode

resolved

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.

Parameters:



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

See Also:



28
29
30
# File 'lib/sass/tree/media_node.rb', line 28

def group_end
  @group_end
end

#queryArray<String, Sass::Script::Node>

The media query for this rule, interspersed with Script::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 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

See Also:



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

def tabs
  @tabs
end

Instance Method Details

#bubbles?Boolean

Returns:

  • (Boolean)

See Also:



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

def bubbles?; true; end

#invisible?Boolean

True when the directive has no visible children.

Returns:

  • (Boolean)


51
52
53
# File 'lib/sass/tree/media_node.rb', line 51

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

#name

See Also:



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

Raises:

  • (NotImplementedError)

See Also:



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

def value; raise NotImplementedError; end