class Sass::Media::QueryList

A comma-separated list of queries.

media_query [ ',' S* media_query ]*

Attributes

queries[RW]

The queries contained in this list.

@return [Array<Query>]

Public Class Methods

new(queries) click to toggle source

@param queries [Array<Query>] See {#queries}

# File lib/sass/media.rb, line 13
def initialize(queries)
  @queries = queries
end

Public Instance Methods

deep_copy() click to toggle source

Returns a deep copy of this query list and all its children.

@return [QueryList]

# File lib/sass/media.rb, line 58
def deep_copy
  QueryList.new(queries.map {|q| q.deep_copy})
end
merge(other) click to toggle source

Merges this query list with another. The returned query list queries for the intersection between the two inputs.

Both query lists should be resolved.

@param other [QueryList] @return [QueryList?] The merged list, or nil if there is no intersection.

# File lib/sass/media.rb, line 24
def merge(other)
  new_queries = queries.map {|q1| other.queries.map {|q2| q1.merge(q2)}}.flatten.compact
  return if new_queries.empty?
  QueryList.new(new_queries)
end
to_a() click to toggle source

Returns a representation of the query as an array of strings and potentially {Sass::Script::Tree::Node}s (if there's interpolation in it). When the interpolation is resolved and the strings are joined together, this will be the string representation of this query.

@return [Array<String, Sass::Script::Tree::Node>]

# File lib/sass/media.rb, line 51
def to_a
  Sass::Util.intersperse(queries.map {|q| q.to_a}, ', ').flatten
end
to_css() click to toggle source

Returns the CSS for the media query list.

@return [String]

# File lib/sass/media.rb, line 33
def to_css
  queries.map {|q| q.to_css}.join(', ')
end
to_src(options) click to toggle source

Returns the Sass/SCSS code for the media query list.

@param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}). @return [String]

# File lib/sass/media.rb, line 41
def to_src(options)
  queries.map {|q| q.to_src(options)}.join(', ')
end