Class: Sass::Media::QueryList
- Inherits:
-  Object - Object
- Sass::Media::QueryList
 
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/media.rb
Overview
A comma-separated list of queries.
media_query [ ',' S* media_query ]*Instance Attribute Summary (collapse)
-   - (Array<Query>) queries   The queries contained in this list. 
Instance Method Summary (collapse)
-   - (QueryList) deep_copy   Returns a deep copy of this query list and all its children. 
-   - (QueryList) initialize(queries)   constructor A new instance of QueryList. 
-   - (QueryList?) merge(other)   Merges this query list with another. 
-   - (Array<String, Sass::Script::Tree::Node>) to_a   Returns a representation of the query as an array of strings and potentially Script::Tree::Nodes (if there’s interpolation in it). 
-   - (String) to_css   Returns the CSS for the media query list. 
-   - (String) to_src(options)   Returns the Sass/SCSS code for the media query list. 
Constructor Details
- (QueryList) initialize(queries)
Returns a new instance of QueryList
| 13 14 15 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/media.rb', line 13
def initialize(queries)
  @queries = queries
end | 
Instance Attribute Details
- (Array<Query>) queries
The queries contained in this list.
| 10 11 12 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/media.rb', line 10
def queries
  @queries
end | 
Instance Method Details
- (QueryList) deep_copy
Returns a deep copy of this query list and all its children.
| 58 59 60 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/media.rb', line 58
def deep_copy
  QueryList.new(queries.map {|q| q.deep_copy})
end | 
- (QueryList?) merge(other)
Merges this query list with another. The returned query list queries for the intersection between the two inputs.
Both query lists should be resolved.
| 24 25 26 27 28 | # File '/Users/ceppstei/Projects/sass-lang/.sass/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 | 
- (Array<String, Sass::Script::Tree::Node>) to_a
Returns a representation of the query as an array of strings and potentially Script::Tree::Nodes (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.
| 51 52 53 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/media.rb', line 51
def to_a
  Sass::Util.intersperse(queries.map {|q| q.to_a}, ', ').flatten
end | 
- (String) to_css
Returns the CSS for the media query list.
| 33 34 35 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/media.rb', line 33
def to_css
  queries.map {|q| q.to_css}.join(', ')
end | 
- (String) to_src(options)
Returns the Sass/SCSS code for the media query list.
| 41 42 43 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/media.rb', line 41
def to_src(options)
  queries.map {|q| q.to_src(options)}.join(', ')
end |