code
stringlengths
26
124k
docstring
stringlengths
23
125k
func_name
stringlengths
1
98
language
stringclasses
1 value
repo
stringlengths
5
53
path
stringlengths
7
151
url
stringlengths
50
211
license
stringclasses
7 values
def chunks(seq1, seq2) chunk1 = [] chunk1 << seq1.shift until yield seq1 chunk2 = [] chunk2 << seq2.shift until yield seq2 return [] if chunk1.empty? && chunk2.empty? return [chunk2] if chunk1.empty? return [chunk1] if chunk2.empty? [chunk1 + chunk2, chunk2 + chunk1] end
Takes initial subsequences of `seq1` and `seq2` and returns all orderings of those subsequences. The initial subsequences are determined by a block. Destructively removes the initial subsequences of `seq1` and `seq2`. For example, given `(A B C | D E)` and `(1 2 | 3 4 5)` (with `|` denoting the boundary of the initial subsequence), this would return `[(A B C 1 2), (1 2 A B C)]`. The sequences would then be `(D E)` and `(3 4 5)`. @param seq1 [Array] @param seq2 [Array] @yield [a] Used to determine when to cut off the initial subsequences. Called repeatedly for each sequence until it returns true. @yieldparam a [Array] A final subsequence of one input sequence after cutting off some initial subsequence. @yieldreturn [Boolean] Whether or not to cut off the initial subsequence here. @return [Array<Array>] All possible orderings of the initial subsequences.
chunks
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
Apache-2.0
def group_selectors(seq) newseq = [] tail = seq.dup until tail.empty? head = [] begin head << tail.shift end while !tail.empty? && head.last.is_a?(String) || tail.first.is_a?(String) newseq << head end newseq end
Groups a sequence into subsequences. The subsequences are determined by strings; adjacent non-string elements will be put into separate groups, but any element adjacent to a string will be grouped with that string. For example, `(A B "C" D E "F" G "H" "I" J)` will become `[(A) (B "C" D) (E "F" G "H" "I" J)]`. @param seq [Array] @return [Array<Array>]
group_selectors
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
Apache-2.0
def _superselector?(seq1, seq2) seq1 = seq1.reject {|e| e == "\n"} seq2 = seq2.reject {|e| e == "\n"} # Selectors with leading or trailing operators are neither # superselectors nor subselectors. return if seq1.last.is_a?(String) || seq2.last.is_a?(String) || seq1.first.is_a?(String) || seq2.first.is_a?(String) # More complex selectors are never superselectors of less complex ones return if seq1.size > seq2.size return seq1.first.superselector?(seq2.last, seq2[0...-1]) if seq1.size == 1 _, si = seq2.each_with_index.find do |e, i| return if i == seq2.size - 1 next if e.is_a?(String) seq1.first.superselector?(e, seq2[0...i]) end return unless si if seq1[1].is_a?(String) return unless seq2[si + 1].is_a?(String) # .foo ~ .bar is a superselector of .foo + .bar return unless seq1[1] == "~" ? seq2[si + 1] != ">" : seq1[1] == seq2[si + 1] # .foo > .baz is not a superselector of .foo > .bar > .baz or .foo > # .bar .baz, despite the fact that .baz is a superselector of .bar > # .baz and .bar .baz. Same goes for + and ~. return if seq1.length == 3 && seq2.length > 3 return _superselector?(seq1[2..-1], seq2[si + 2..-1]) elsif seq2[si + 1].is_a?(String) return unless seq2[si + 1] == ">" return _superselector?(seq1[1..-1], seq2[si + 2..-1]) else return _superselector?(seq1[1..-1], seq2[si + 1..-1]) end end
Given two selector sequences, returns whether `seq1` is a superselector of `seq2`; that is, whether `seq1` matches every element `seq2` matches. @param seq1 [Array<SimpleSequence or String>] @param seq2 [Array<SimpleSequence or String>] @return [Boolean]
_superselector?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
Apache-2.0
def parent_superselector?(seq1, seq2) base = Sass::Selector::SimpleSequence.new([Sass::Selector::Placeholder.new('<temp>')], false) _superselector?(seq1 + [base], seq2 + [base]) end
Like \{#_superselector?}, but compares the selectors in the context of parent selectors, as though they shared an implicit base simple selector. For example, `B` is not normally a superselector of `B A`, since it doesn't match `A` elements. However, it is a parent superselector, since `B X` is a superselector of `B A X`. @param seq1 [Array<SimpleSequence or String>] @param seq2 [Array<SimpleSequence or String>] @return [Boolean]
parent_superselector?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
Apache-2.0
def must_unify?(seq1, seq2) unique_selectors = seq1.map do |sseq| next [] if sseq.is_a?(String) sseq.members.select {|sel| sel.unique?} end.flatten.to_set return false if unique_selectors.empty? seq2.any? do |sseq| next false if sseq.is_a?(String) sseq.members.any? do |sel| next unless sel.unique? unique_selectors.include?(sel) end end end
Returns whether two selectors must be unified to produce a valid combined selector. This is true when both selectors contain the same unique simple selector such as an id. @param seq1 [Array<SimpleSequence or String>] @param seq2 [Array<SimpleSequence or String>] @return [Boolean]
must_unify?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
Apache-2.0
def trim(seqses) # Avoid truly horrific quadratic behavior. TODO: I think there # may be a way to get perfect trimming without going quadratic. return seqses.flatten(1) if seqses.size > 100 # Keep the results in a separate array so we can be sure we aren't # comparing against an already-trimmed selector. This ensures that two # identical selectors don't mutually trim one another. result = seqses.dup # This is n^2 on the sequences, but only comparing between # separate sequences should limit the quadratic behavior. seqses.each_with_index do |seqs1, i| result[i] = seqs1.reject do |seq1| # The maximum specificity of the sources that caused [seq1] to be # generated. In order for [seq1] to be removed, there must be # another selector that's a superselector of it *and* that has # specificity greater or equal to this. max_spec = _sources(seq1).map do |seq| spec = seq.specificity spec.is_a?(Range) ? spec.max : spec end.max || 0 result.any? do |seqs2| next if seqs1.equal?(seqs2) # Second Law of Extend: the specificity of a generated selector # should never be less than the specificity of the extending # selector. # # See https://github.com/nex3/sass/issues/324. seqs2.any? do |seq2| spec2 = _specificity(seq2) spec2 = spec2.begin if spec2.is_a?(Range) spec2 >= max_spec && _superselector?(seq2, seq1) end end end end result.flatten(1) end
Removes redundant selectors from between multiple lists of selectors. This takes a list of lists of selector sequences; each individual list is assumed to have no redundancy within itself. A selector is only removed if it's redundant with a selector in another list. "Redundant" here means that one selector is a superselector of the other. The more specific selector is removed. @param seqses [Array<Array<Array<SimpleSequence or String>>>] @return [Array<Array<SimpleSequence or String>>]
trim
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/sequence.rb
Apache-2.0
def hash @_hash ||= equality_key.hash end
Returns a hash code for this selector object. By default, this is based on the value of \{#to\_a}, so if that contains information irrelevant to the identity of the selector, this should be overridden. @return [Integer]
hash
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple.rb
Apache-2.0
def eql?(other) other.class == self.class && other.hash == hash && other.equality_key == equality_key end
Checks equality between this and another object. By default, this is based on the value of \{#to\_a}, so if that contains information irrelevant to the identity of the selector, this should be overridden. @param other [Object] The object to test equality against @return [Boolean] Whether or not this is equal to `other`
eql?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple.rb
Apache-2.0
def unify(sels) return sels.first.unify([self]) if sels.length == 1 && sels.first.is_a?(Universal) return sels if sels.any? {|sel2| eql?(sel2)} if !is_a?(Pseudo) || (sels.last.is_a?(Pseudo) && sels.last.type == :element) _, i = sels.each_with_index.find {|sel, _| sel.is_a?(Pseudo)} end return sels + [self] unless i sels[0...i] + [self] + sels[i..-1] end
Unifies this selector with a {SimpleSequence}'s {SimpleSequence#members members array}, returning another `SimpleSequence` members array that matches both this selector and the input selector. By default, this just appends this selector to the end of the array (or returns the original array if this selector already exists in it). @param sels [Array<Simple>] A {SimpleSequence}'s {SimpleSequence#members members array} @return [Array<Simple>, nil] A {SimpleSequence} {SimpleSequence#members members array} matching both `sels` and this selector, or `nil` if this is impossible (e.g. unifying `#foo` and `#bar`) @raise [Sass::SyntaxError] If this selector cannot be unified. This will only ever occur when a dynamic selector, such as {Parent} or {Interpolation}, is used in unification. Since these selectors should be resolved by the time extension and unification happen, this exception will only ever be raised as a result of programmer error
unify
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple.rb
Apache-2.0
def equality_key @equality_key ||= to_s end
Returns the key used for testing whether selectors are equal. This is a cached version of \{#to\_s}. @return [String]
equality_key
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple.rb
Apache-2.0
def unify_namespaces(ns1, ns2) return ns2, true if ns1 == '*' return ns1, true if ns2 == '*' return nil, false unless ns1 == ns2 [ns1, true] end
Unifies two namespaces, returning a namespace that works for both of them if possible. @param ns1 [String, nil] The first namespace. `nil` means none specified, e.g. `foo`. The empty string means no namespace specified, e.g. `|foo`. `"*"` means any namespace is allowed, e.g. `*|foo`. @param ns2 [String, nil] The second namespace. See `ns1`. @return [Array(String or nil, Boolean)] The first value is the unified namespace, or `nil` for no namespace. The second value is whether or not a namespace that works for both inputs could be found at all. If the second value is `false`, the first should be ignored.
unify_namespaces
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple.rb
Apache-2.0
def base @base ||= (members.first if members.first.is_a?(Element) || members.first.is_a?(Universal)) end
Returns the element or universal selector in this sequence, if it exists. @return [Element, Universal, nil]
base
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
Apache-2.0
def rest @rest ||= Set.new(members - [base] - pseudo_elements) end
Returns the non-base, non-pseudo-element selectors in this sequence. @return [Set<Simple>]
rest
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
Apache-2.0
def initialize(selectors, subject, source_range = nil) @members = selectors @subject = subject @sources = Set.new @source_range = source_range end
@param selectors [Array<Simple>] See \{#members} @param subject [Boolean] See \{#subject?} @param source_range [Sass::Source::Range]
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
Apache-2.0
def resolve_parent_refs(super_cseq) resolved_members = @members.map do |sel| next sel unless sel.is_a?(Pseudo) && sel.selector sel.with_selector(sel.selector.resolve_parent_refs(super_cseq, false)) end.flatten # Parent selector only appears as the first selector in the sequence unless (parent = resolved_members.first).is_a?(Parent) return CommaSequence.new([Sequence.new([SimpleSequence.new(resolved_members, subject?)])]) end return super_cseq if @members.size == 1 && parent.suffix.nil? CommaSequence.new(super_cseq.members.map do |super_seq| members = super_seq.members.dup newline = members.pop if members.last == "\n" unless members.last.is_a?(SimpleSequence) raise Sass::SyntaxError.new("Invalid parent selector for \"#{self}\": \"" + super_seq.to_s + '"') end parent_sub = members.last.members unless parent.suffix.nil? parent_sub = parent_sub.dup parent_sub[-1] = parent_sub.last.dup case parent_sub.last when Sass::Selector::Class, Sass::Selector::Id, Sass::Selector::Placeholder parent_sub[-1] = parent_sub.last.class.new(parent_sub.last.name + parent.suffix) when Sass::Selector::Element parent_sub[-1] = parent_sub.last.class.new( parent_sub.last.name + parent.suffix, parent_sub.last.namespace) when Sass::Selector::Pseudo if parent_sub.last.arg || parent_sub.last.selector raise Sass::SyntaxError.new("Invalid parent selector for \"#{self}\": \"" + super_seq.to_s + '"') end parent_sub[-1] = Sass::Selector::Pseudo.new( parent_sub.last.type, parent_sub.last.name + parent.suffix, nil, nil) else raise Sass::SyntaxError.new("Invalid parent selector for \"#{self}\": \"" + super_seq.to_s + '"') end end Sequence.new(members[0...-1] + [SimpleSequence.new(parent_sub + resolved_members[1..-1], subject?)] + [newline].compact) end) end
Resolves the {Parent} selectors within this selector by replacing them with the given parent selector, handling commas appropriately. @param super_cseq [CommaSequence] The parent selector @return [CommaSequence] This selector, with parent references resolved @raise [Sass::SyntaxError] If a parent selector is invalid
resolve_parent_refs
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
Apache-2.0
def do_extend(extends, parent_directives, replace, seen) seen_with_pseudo_selectors = seen.dup modified_original = false members = self.members.map do |sel| next sel unless sel.is_a?(Pseudo) && sel.selector next sel if seen.include?([sel]) extended = sel.selector.do_extend(extends, parent_directives, replace, seen, false) next sel if extended == sel.selector extended.members.reject! {|seq| seq.invisible?} # For `:not()`, we usually want to get rid of any complex # selectors because that will cause the selector to fail to # parse on all browsers at time of writing. We can keep them # if either the original selector had a complex selector, or # the result of extending has only complex selectors, # because either way we aren't breaking anything that isn't # already broken. if sel.normalized_name == 'not' && (sel.selector.members.none? {|seq| seq.members.length > 1} && extended.members.any? {|seq| seq.members.length == 1}) extended.members.reject! {|seq| seq.members.length > 1} end modified_original = true result = sel.with_selector(extended) result.each {|new_sel| seen_with_pseudo_selectors << [new_sel]} result end.flatten groups = extends[members.to_set].group_by {|ex| ex.extender}.to_a groups.map! do |seq, group| sels = group.map {|e| e.target}.flatten # If A {@extend B} and C {...}, # seq is A, sels is B, and self is C self_without_sel = Sass::Util.array_minus(members, sels) group.each {|e| e.success = true} unified = seq.members.last.unify(SimpleSequence.new(self_without_sel, subject?)) next unless unified group.each {|e| check_directives_match!(e, parent_directives)} new_seq = Sequence.new(seq.members[0...-1] + [unified]) new_seq.add_sources!(sources + [seq]) [sels, new_seq] end groups.compact! groups.map! do |sels, seq| next [] if seen.include?(sels) seq.do_extend( extends, parent_directives, false, seen_with_pseudo_selectors + [sels], false) end groups.flatten! if modified_original || !replace || groups.empty? # First Law of Extend: the result of extending a selector should # (almost) always contain the base selector. # # See https://github.com/nex3/sass/issues/324. original = Sequence.new([SimpleSequence.new(members, @subject, source_range)]) original.add_sources! sources groups.unshift original end groups.uniq! groups end
Non-destructively extends this selector with the extensions specified in a hash (which should come from {Sass::Tree::Visitors::Cssize}). @param extends [{Selector::Simple => Sass::Tree::Visitors::Cssize::Extend}] The extensions to perform on this selector @param parent_directives [Array<Sass::Tree::DirectiveNode>] The directives containing this selector. @param seen [Set<Array<Selector::Simple>>] The set of simple sequences that are currently being replaced. @param original [Boolean] Whether this is the original selector being extended, as opposed to the result of a previous extension that's being re-extended. @return [Array<Sequence>] A list of selectors generated by extending this selector with `extends`. @see CommaSequence#do_extend
do_extend
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
Apache-2.0
def unify(other) sseq = members.inject(other.members) do |member, sel| return unless member sel.unify(member) end return unless sseq SimpleSequence.new(sseq, other.subject? || subject?) end
Unifies this selector with another {SimpleSequence}, returning another `SimpleSequence` that is a subselector of both input selectors. @param other [SimpleSequence] @return [SimpleSequence, nil] A {SimpleSequence} matching both `sels` and this selector, or `nil` if this is impossible (e.g. unifying `#foo` and `#bar`) @raise [Sass::SyntaxError] If this selector cannot be unified. This will only ever occur when a dynamic selector, such as {Parent} or {Interpolation}, is used in unification. Since these selectors should be resolved by the time extension and unification happen, this exception will only ever be raised as a result of programmer error
unify
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
Apache-2.0
def superselector?(their_sseq, parents = []) return false unless base.nil? || base.eql?(their_sseq.base) return false unless pseudo_elements.eql?(their_sseq.pseudo_elements) our_spcs = selector_pseudo_classes their_spcs = their_sseq.selector_pseudo_classes # Some psuedo-selectors can be subselectors of non-pseudo selectors. # Pull those out here so we can efficiently check against them below. their_subselector_pseudos = %w(matches any nth-child nth-last-child). map {|name| their_spcs[name] || []}.flatten # If `self`'s non-pseudo simple selectors aren't a subset of `their_sseq`'s, # it's definitely not a superselector. This also considers being matched # by `:matches` or `:any`. return false unless rest.all? do |our_sel| next true if our_sel.is_a?(Pseudo) && our_sel.selector next true if their_sseq.rest.include?(our_sel) their_subselector_pseudos.any? do |their_pseudo| their_pseudo.selector.members.all? do |their_seq| next false unless their_seq.members.length == 1 their_sseq = their_seq.members.first next false unless their_sseq.is_a?(SimpleSequence) their_sseq.rest.include?(our_sel) end end end our_spcs.all? do |_name, pseudos| pseudos.all? {|pseudo| pseudo.superselector?(their_sseq, parents)} end end
Returns whether or not this selector matches all elements that the given selector matches (as well as possibly more). @example (.foo).superselector?(.foo.bar) #=> true (.foo).superselector?(.bar) #=> false @param their_sseq [SimpleSequence] @param parents [Array<SimpleSequence, String>] The parent selectors of `their_sseq`, if any. @return [Boolean]
superselector?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
Apache-2.0
def inspect res = members.map {|m| m.inspect}.join res << '!' if subject? res end
Returns a string representation of the sequence. This is basically the selector string. @return [String]
inspect
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
Apache-2.0
def with_more_sources(sources) sseq = dup sseq.members = members.dup sseq.sources = self.sources | sources sseq end
Return a copy of this simple sequence with `sources` merged into the {SimpleSequence#sources} set. @param sources [Set<Sequence>] @return [SimpleSequence]
with_more_sources
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/selector/simple_sequence.rb
Apache-2.0
def inspect "#{input.inspect} => #{output.inspect}" end
@return [String] A string representation of the mapping.
inspect
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/map.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/map.rb
Apache-2.0
def add(input, output) @data.push(Mapping.new(input, output)) end
Adds a new mapping from one source range to another. Multiple invocations of this method should have each `output` range come after all previous ranges. @param input [Sass::Source::Range] The source range in the input document. @param output [Sass::Source::Range] The source range in the output document.
add
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/map.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/map.rb
Apache-2.0
def shift_output_lines(delta) return if delta == 0 @data.each do |m| m.output.start_pos.line += delta m.output.end_pos.line += delta end end
Shifts all output source ranges forward one or more lines. @param delta [Integer] The number of lines to shift the ranges forward.
shift_output_lines
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/map.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/map.rb
Apache-2.0
def shift_output_offsets(delta) return if delta == 0 @data.each do |m| break if m.output.start_pos.line > 1 m.output.start_pos.offset += delta m.output.end_pos.offset += delta if m.output.end_pos.line > 1 end end
Shifts any output source ranges that lie on the first line forward one or more characters on that line. @param delta [Integer] The number of characters to shift the ranges forward.
shift_output_offsets
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/map.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/map.rb
Apache-2.0
def to_json(options) css_uri, css_path, sourcemap_path = options[:css_uri], options[:css_path], options[:sourcemap_path] unless css_uri || (css_path && sourcemap_path) raise ArgumentError.new("Sass::Source::Map#to_json requires either " \ "the :css_uri option or both the :css_path and :soucemap_path options.") end css_path &&= Sass::Util.pathname(File.absolute_path(css_path)) sourcemap_path &&= Sass::Util.pathname(File.absolute_path(sourcemap_path)) css_uri ||= Sass::Util.file_uri_from_path( Sass::Util.relative_path_from(css_path, sourcemap_path.dirname)) result = "{\n" write_json_field(result, "version", 3, true) source_uri_to_id = {} id_to_source_uri = {} id_to_contents = {} if options[:type] == :inline next_source_id = 0 line_data = [] segment_data_for_line = [] # These track data necessary for the delta coding. previous_target_line = nil previous_target_offset = 1 previous_source_line = 1 previous_source_offset = 1 previous_source_id = 0 @data.each do |m| file, importer = m.input.file, m.input.importer next unless importer if options[:type] == :inline source_uri = file else sourcemap_dir = sourcemap_path && sourcemap_path.dirname.to_s sourcemap_dir = nil if options[:type] == :file source_uri = importer.public_url(file, sourcemap_dir) next unless source_uri end current_source_id = source_uri_to_id[source_uri] unless current_source_id current_source_id = next_source_id next_source_id += 1 source_uri_to_id[source_uri] = current_source_id id_to_source_uri[current_source_id] = source_uri if options[:type] == :inline id_to_contents[current_source_id] = importer.find(file, {}).instance_variable_get('@template') end end [ [m.input.start_pos, m.output.start_pos], [m.input.end_pos, m.output.end_pos] ].each do |source_pos, target_pos| if previous_target_line != target_pos.line line_data.push(segment_data_for_line.join(",")) unless segment_data_for_line.empty? (target_pos.line - 1 - (previous_target_line || 0)).times {line_data.push("")} previous_target_line = target_pos.line previous_target_offset = 1 segment_data_for_line = [] end # `segment` is a data chunk for a single position mapping. segment = "" # Field 1: zero-based starting offset. segment << Sass::Util.encode_vlq(target_pos.offset - previous_target_offset) previous_target_offset = target_pos.offset # Field 2: zero-based index into the "sources" list. segment << Sass::Util.encode_vlq(current_source_id - previous_source_id) previous_source_id = current_source_id # Field 3: zero-based starting line in the original source. segment << Sass::Util.encode_vlq(source_pos.line - previous_source_line) previous_source_line = source_pos.line # Field 4: zero-based starting offset in the original source. segment << Sass::Util.encode_vlq(source_pos.offset - previous_source_offset) previous_source_offset = source_pos.offset segment_data_for_line.push(segment) previous_target_line = target_pos.line end end line_data.push(segment_data_for_line.join(",")) write_json_field(result, "mappings", line_data.join(";")) source_names = [] (0...next_source_id).each {|id| source_names.push(id_to_source_uri[id].to_s)} write_json_field(result, "sources", source_names) if options[:type] == :inline write_json_field(result, "sourcesContent", (0...next_source_id).map {|id| id_to_contents[id]}) end write_json_field(result, "names", []) write_json_field(result, "file", css_uri) result << "\n}" result end
Returns the standard JSON representation of the source map. If the `:css_uri` option isn't specified, the `:css_path` and `:sourcemap_path` options must both be specified. Any options may also be specified alongside the `:css_uri` option. If `:css_uri` isn't specified, it will be inferred from `:css_path` and `:sourcemap_path` using the assumption that the local file system has the same layout as the server. Regardless of which options are passed to this method, source stylesheets that are imported using a non-default importer will only be linked to in the source map if their importers implement \{Sass::Importers::Base#public\_url\}. @option options :css_uri [String] The publicly-visible URI of the CSS output file. @option options :css_path [String] The local path of the CSS output file. @option options :sourcemap_path [String] The (eventual) local path of the sourcemap file. @option options :type [Symbol] `:auto` (default), `:file`, or `:inline`. @return [String] The JSON string. @raise [ArgumentError] If neither `:css_uri` nor `:css_path` and `:sourcemap_path` are specified.
to_json
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/map.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/map.rb
Apache-2.0
def initialize(line, offset) @line = line @offset = offset end
@param line [Integer] The source line @param offset [Integer] The source offset
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/position.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/position.rb
Apache-2.0
def after(str) newlines = str.count("\n") Position.new(line + newlines, if newlines == 0 offset + str.length else str.length - str.rindex("\n") - 1 end) end
@param str [String] The string to move through. @return [Position] The source position after proceeding forward through `str`.
after
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/position.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/position.rb
Apache-2.0
def initialize(start_pos, end_pos, file, importer = nil) @start_pos = start_pos @end_pos = end_pos @file = file @importer = importer end
@param start_pos [Sass::Source::Position] See \{#start_pos} @param end_pos [Sass::Source::Position] See \{#end_pos} @param file [String] See \{#file} @param importer [Sass::Importers::Base] See \{#importer}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/range.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/range.rb
Apache-2.0
def inspect "(#{start_pos.inspect} to #{end_pos.inspect}#{" in #{@file}" if @file})" end
@return [String] A string representation of the source range.
inspect
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/range.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/source/range.rb
Apache-2.0
def exclude?(directive) if resolved_type == :with return false if resolved_value.include?('all') !resolved_value.include?(directive) else # resolved_type == :without return true if resolved_value.include?('all') resolved_value.include?(directive) end end
Returns whether or not the given directive is excluded by this node. `directive` may be "rule", which indicates whether normal CSS rules should be excluded. @param directive [String] @return [Boolean]
exclude?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/at_root_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/at_root_node.rb
Apache-2.0
def exclude_node?(node) return exclude?(node.name.gsub(/^@/, '')) if node.is_a?(Sass::Tree::DirectiveNode) return exclude?('keyframes') if node.is_a?(Sass::Tree::KeyframeRuleNode) exclude?('rule') && node.is_a?(Sass::Tree::RuleNode) end
Returns whether the given node is excluded by this node. @param node [Sass::Tree::Node] @return [Boolean]
exclude_node?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/at_root_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/at_root_node.rb
Apache-2.0
def initialize(value, type) @value = Sass::Util.with_extracted_values(value) {|str| normalize_indentation str} @type = type super() end
@param value [Array<String, Sass::Script::Tree::Node>] See \{#value} @param type [Symbol] See \{#type}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/comment_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/comment_node.rb
Apache-2.0
def invisible? case @type when :loud; false when :silent; true else; style == :compressed end end
Returns `true` if this is a silent comment or the current style doesn't render comments. Comments starting with ! are never invisible (and the ! is removed from the output.) @return [Boolean]
invisible?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/comment_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/comment_node.rb
Apache-2.0
def lines @value.inject(0) do |s, e| next s + e.count("\n") if e.is_a?(String) next s end end
Returns the number of lines in the comment. @return [Integer]
lines
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/comment_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/comment_node.rb
Apache-2.0
def initialize(uri, query = [], supports_condition = nil) @uri = uri @query = query @supports_condition = supports_condition super('') end
@param uri [String, Sass::Script::Tree::Node] See \{#uri} @param query [Array<String, Sass::Script::Tree::Node>] See \{#query} @param supports_condition [Sass::Supports::Condition] See \{#supports_condition}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/css_import_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/css_import_node.rb
Apache-2.0
def initialize(expr) @expr = expr super() end
@param expr [Script::Tree::Node] The expression to print
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/debug_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/debug_node.rb
Apache-2.0
def initialize(value) @value = value @tabs = 0 super() end
@param value [Array<String, Sass::Script::Tree::Node>] See \{#value}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/directive_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/directive_node.rb
Apache-2.0
def name @name ||= value.first.gsub(/ .*$/, '') end
@return [String] The name of the directive, including `@`.
name
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/directive_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/directive_node.rb
Apache-2.0
def normalized_name @normalized_name ||= name.gsub(/^(@)(?:-[a-zA-Z0-9]+-)?/, '\1').downcase end
Strips out any vendor prefixes and downcases the directive name. @return [String] The normalized name of the directive.
normalized_name
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/directive_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/directive_node.rb
Apache-2.0
def initialize(vars, list) @vars = vars @list = list super() end
@param vars [Array<String>] The names of the loop variables @param list [Script::Tree::Node] The parse tree for the list
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/each_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/each_node.rb
Apache-2.0
def initialize(expr) @expr = expr super() end
@param expr [Script::Tree::Node] The expression to print
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/error_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/error_node.rb
Apache-2.0
def initialize(selector, optional, selector_source_range) @selector = selector @optional = optional @selector_source_range = selector_source_range super() end
@param selector [Array<String, Sass::Script::Tree::Node>] The CSS selector to extend, interspersed with {Sass::Script::Tree::Node}s representing `#{}`-interpolation. @param optional [Boolean] See \{ExtendNode#optional?} @param selector_source_range [Sass::Source::Range] The extended selector source range.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/extend_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/extend_node.rb
Apache-2.0
def initialize(var, from, to, exclusive) @var = var @from = from @to = to @exclusive = exclusive super() end
@param var [String] See \{#var} @param from [Script::Tree::Node] See \{#from} @param to [Script::Tree::Node] See \{#to} @param exclusive [Boolean] See \{#exclusive}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/for_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/for_node.rb
Apache-2.0
def normalized_name @normalized_name ||= name.gsub(/^(?:-[a-zA-Z0-9]+-)?/, '\1') end
Strips out any vendor prefixes. @return [String] The normalized name of the directive.
normalized_name
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/function_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/function_node.rb
Apache-2.0
def initialize(name, args, splat) @name = name @args = args @splat = splat super() return unless %w(and or not).include?(name) raise Sass::SyntaxError.new("Invalid function name \"#{name}\".") end
@param name [String] The function name @param args [Array<(Script::Tree::Node, Script::Tree::Node)>] The arguments for the function. @param splat [Script::Tree::Node] See \{#splat}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/function_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/function_node.rb
Apache-2.0
def initialize(expr) @expr = expr @last_else = self super() end
@param expr [Script::Expr] See \{#expr}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/if_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/if_node.rb
Apache-2.0
def add_else(node) @last_else.else = node @last_else = node end
Append an `@else` node to the end of the list. @param node [IfNode] The `@else` node to append
add_else
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/if_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/if_node.rb
Apache-2.0
def initialize(imported_filename) @imported_filename = imported_filename super(nil) end
@param imported_filename [String] The name of the imported file
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/import_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/import_node.rb
Apache-2.0
def imported_file @imported_file ||= import end
Returns the imported file. @return [Sass::Engine] @raise [Sass::SyntaxError] If no file could be found to import.
imported_file
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/import_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/import_node.rb
Apache-2.0
def initialize(query) @query = query super('') end
@param query [Array<String, Sass::Script::Tree::Node>] See \{#query}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/media_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/media_node.rb
Apache-2.0
def invisible? children.all? {|c| c.invisible?} end
True when the directive has no visible children. @return [Boolean]
invisible?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/media_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/media_node.rb
Apache-2.0
def initialize(name, args, splat) @name = name @args = args @splat = splat super() end
@param name [String] The mixin name @param args [Array<(Script::Tree::Node, Script::Tree::Node)>] See \{#args} @param splat [Script::Tree::Node] See \{#splat}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/mixin_def_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/mixin_def_node.rb
Apache-2.0
def initialize(name, args, keywords, splat, kwarg_splat) @name = name @args = args @keywords = keywords @splat = splat @kwarg_splat = kwarg_splat super() end
@param name [String] The name of the mixin @param args [Array<Script::Tree::Node>] See \{#args} @param splat [Script::Tree::Node] See \{#splat} @param kwarg_splat [Script::Tree::Node] See \{#kwarg_splat} @param keywords [Sass::Util::NormalizedMap<Script::Tree::Node>] See \{#keywords}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/mixin_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/mixin_node.rb
Apache-2.0
def filename @filename || (@options && @options[:filename]) end
The name of the document on which this node appeared. @return [String]
filename
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
Apache-2.0
def css_with_sourcemap visitor = Sass::Tree::Visitors::ToCss.new(:build_source_mapping) result = visitor.visit(self) return result, visitor.source_mapping end
Computes the CSS corresponding to this static CSS tree, along with the respective source map. @return [(String, Sass::Source::Map)] The resulting CSS and the source map @see Sass::Tree
css_with_sourcemap
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
Apache-2.0
def inspect return self.class.to_s unless has_children "(#{self.class} #{children.map {|c| c.inspect}.join(' ')})" end
Returns a representation of the node for debugging purposes. @return [String]
inspect
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
Apache-2.0
def each yield self children.each {|c| c.each {|n| yield n}} end
Iterates through each node in the tree rooted at this node in a pre-order walk. @yield node @yieldparam node [Node] a node in the tree
each
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
Apache-2.0
def to_sass(options = {}) Sass::Tree::Visitors::Convert.visit(self, options, :sass) end
Converts a node to Sass code that will generate it. @param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}) @return [String] The Sass code corresponding to the node
to_sass
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
Apache-2.0
def to_scss(options = {}) Sass::Tree::Visitors::Convert.visit(self, options, :scss) end
Converts a node to SCSS code that will generate it. @param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}) @return [String] The Sass code corresponding to the node
to_scss
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
Apache-2.0
def balance(*args) res = Sass::Shared.balance(*args) return res if res raise Sass::SyntaxError.new("Unbalanced brackets.", :line => line) end
@see Sass::Shared.balance @raise [Sass::SyntaxError] if the brackets aren't balanced
balance
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/node.rb
Apache-2.0
def custom_property? name.first.is_a?(String) && name.first.start_with?("--") end
Whether this represents a CSS custom property. @return [Boolean]
custom_property?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
Apache-2.0
def initialize(name, value, prop_syntax) @name = Sass::Util.strip_string_array( Sass::Util.merge_adjacent_strings(name)) @value = Sass::Util.merge_adjacent_strings(value) @value = Sass::Util.strip_string_array(@value) unless custom_property? @tabs = 0 @prop_syntax = prop_syntax super() end
@param name [Array<String, Sass::Script::Tree::Node>] See \{#name} @param value [Array<String, Sass::Script::Tree::Node>] See \{#value} @param prop_syntax [Symbol] `:new` if this property uses `a: b`-style syntax, `:old` if it uses `:a b`-style syntax
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
Apache-2.0
def pseudo_class_selector_message if @prop_syntax == :new || custom_property? || !value.first.is_a?(Sass::Script::Tree::Literal) || !value.first.value.is_a?(Sass::Script::Value::String) || !value.first.value.value.empty? return "" end "\nIf #{declaration.dump} should be a selector, use \"\\#{declaration}\" instead." end
Returns a appropriate message indicating how to escape pseudo-class selectors. This only applies for old-style properties with no value, so returns the empty string if this is new-style. @return [String] The message
pseudo_class_selector_message
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
Apache-2.0
def declaration(opts = {:old => @prop_syntax == :old}, fmt = :sass) name = self.name.map {|n| n.is_a?(String) ? n : n.to_sass(opts)}.join value = self.value.map {|n| n.is_a?(String) ? n : n.to_sass(opts)}.join value = "(#{value})" if value_needs_parens? if name[0] == ?: raise Sass::SyntaxError.new("The \"#{name}: #{value}\"" + " hack is not allowed in the Sass indented syntax") end # The indented syntax doesn't support newlines in custom property values, # but we can losslessly convert them to spaces instead. value = value.tr("\n", " ") if fmt == :sass old = opts[:old] && fmt == :sass "#{old ? ':' : ''}#{name}#{old ? '' : ':'}#{custom_property? ? '' : ' '}#{value}".rstrip end
Computes the Sass or SCSS code for the variable declaration. This is like \{#to\_scss} or \{#to\_sass}, except it doesn't print any child properties or a trailing semicolon. @param opts [{Symbol => Object}] The options hash for the tree. @param fmt [Symbol] `:scss` or `:sass`.
declaration
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
Apache-2.0
def invisible? !custom_property? && resolved_value.empty? end
A property node is invisible if its value is empty. @return [Boolean]
invisible?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
Apache-2.0
def value_needs_parens? return false if custom_property? root = value.first root.is_a?(Sass::Script::Tree::Operation) && root.operator == :div && root.operand1.is_a?(Sass::Script::Tree::Literal) && root.operand1.value.is_a?(Sass::Script::Value::Number) && root.operand1.value.original.nil? && root.operand2.is_a?(Sass::Script::Tree::Literal) && root.operand2.value.is_a?(Sass::Script::Value::Number) && root.operand2.value.original.nil? end
Returns whether \{#value} neesd parentheses in order to be parsed properly as division.
value_needs_parens?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/prop_node.rb
Apache-2.0
def initialize(expr) @expr = expr super() end
@param expr [Script::Tree::Node] The expression to return
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/return_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/return_node.rb
Apache-2.0
def initialize(template) super() @template = template end
@param template [String] The Sass template from which this node was created
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/root_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/root_node.rb
Apache-2.0
def initialize(rule, selector_source_range = nil) if rule.is_a?(Sass::Selector::CommaSequence) @rule = [rule.to_s] @parsed_rules = rule else merged = Sass::Util.merge_adjacent_strings(rule) @rule = Sass::Util.strip_string_array(merged) try_to_parse_non_interpolated_rules end @selector_source_range = selector_source_range @tabs = 0 super() end
@param rule [Array<String, Sass::Script::Tree::Node>, Sass::Selector::CommaSequence] The CSS rule, either unparsed or parsed. @param selector_source_range [Sass::Source::Range]
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/rule_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/rule_node.rb
Apache-2.0
def add_rules(node) @rule = Sass::Util.strip_string_array( Sass::Util.merge_adjacent_strings(@rule + ["\n"] + node.rule)) try_to_parse_non_interpolated_rules end
Adds another {RuleNode}'s rules to this one's. @param node [RuleNode] The other node
add_rules
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/rule_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/rule_node.rb
Apache-2.0
def continued? last = @rule.last last.is_a?(String) && last[-1] == ?, end
@return [Boolean] Whether or not this rule is continued on the next line
continued?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/rule_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/rule_node.rb
Apache-2.0
def invisible? resolved_rules.members.all? {|seq| seq.invisible?} end
A rule node is invisible if it has only placeholder selectors.
invisible?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/rule_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/rule_node.rb
Apache-2.0
def initialize(name, condition) @name = name @condition = condition super('') end
@param condition [Sass::Supports::Condition] See \{#condition}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/supports_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/supports_node.rb
Apache-2.0
def invisible? children.all? {|c| c.invisible?} end
True when the directive has no visible children. @return [Boolean]
invisible?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/supports_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/supports_node.rb
Apache-2.0
def initialize(name) @name = name self.has_children = true super() end
@param name [String] The name of the trace entry to add.
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/trace_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/trace_node.rb
Apache-2.0
def initialize(name, expr, guarded, global) @name = name @expr = expr @guarded = guarded @global = global super() end
@param name [String] The name of the variable @param expr [Script::Tree::Node] See \{#expr} @param guarded [Boolean] See \{#guarded} @param global [Boolean] See \{#global}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/variable_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/variable_node.rb
Apache-2.0
def initialize(expr) @expr = expr super() end
@param expr [Script::Tree::Node] The expression to print
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/warn_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/warn_node.rb
Apache-2.0
def initialize(expr) @expr = expr super() end
@param expr [Script::Tree::Node] See \{#expr}
initialize
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/while_node.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/while_node.rb
Apache-2.0
def visit(node) if respond_to?(node.class.visit_method, true) send(node.class.visit_method, node) {visit_children(node)} else visit_children(node) end end
Runs the visitor on the given node. This can be overridden by subclasses that need to do something for each node. @param node [Tree::Node] The node to visit. @return [Object] The return value of the `visit_*` method for this node.
visit
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/base.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/base.rb
Apache-2.0
def visit_children(parent) parent.children.map {|c| visit(c)} end
Visit the child nodes for a given node. This can be overridden by subclasses that need to do something with the child nodes' return values. This method is run when `visit_*` methods `yield`, and its return value is returned from the `yield`. @param parent [Tree::Node] The parent node of the children to visit. @return [Array<Object>] The return values of the `visit_*` methods for the children.
visit_children
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/base.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/base.rb
Apache-2.0
def visit_if(node) yield visit(node.else) if node.else node end
`yield`s, then runs the visitor on the `@else` clause if the node has one. This exists to ensure that the contents of the `@else` clause get visited.
visit_if
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/base.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/base.rb
Apache-2.0
def transparent_parent?(parent, grandparent) is_any_of?(parent, SCRIPT_NODES) || (parent.bubbles? && !grandparent.is_a?(Sass::Tree::RootNode) && !grandparent.is_a?(Sass::Tree::AtRootNode)) end
Whether `parent` should be assigned to `@parent`.
transparent_parent?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/check_nesting.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/check_nesting.rb
Apache-2.0
def visit_rule_level(nodes) (nodes + [nil]).each_cons(2).map do |child, nxt| visit(child) + if nxt && (child.is_a?(Sass::Tree::CommentNode) && child.line + child.lines + 1 == nxt.line) || (child.is_a?(Sass::Tree::ImportNode) && nxt.is_a?(Sass::Tree::ImportNode) && child.line + 1 == nxt.line) || (child.is_a?(Sass::Tree::VariableNode) && nxt.is_a?(Sass::Tree::VariableNode) && child.line + 1 == nxt.line) || (child.is_a?(Sass::Tree::PropNode) && nxt.is_a?(Sass::Tree::PropNode)) || (child.is_a?(Sass::Tree::MixinNode) && nxt.is_a?(Sass::Tree::MixinNode) && child.line + 1 == nxt.line) "" else "\n" end end.join.rstrip + "\n" end
Visit rule-level nodes and return their conversion with appropriate whitespace added.
visit_rule_level
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/convert.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/convert.rb
Apache-2.0
def query_interp_to_src(interp) interp = interp.map do |e| next e unless e.is_a?(Sass::Script::Tree::Literal) next e unless e.value.is_a?(Sass::Script::Value::String) e.value.value end interp_to_src(interp) end
Like interp_to_src, but removes the unnecessary `#{}` around the keys and values in query expressions.
query_interp_to_src
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/convert.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/convert.rb
Apache-2.0
def visit(node) super(node) rescue Sass::SyntaxError => e e.modify_backtrace(:filename => node.filename, :line => node.line) raise e end
If an exception is raised, this adds proper metadata to the backtrace.
visit
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit_children(parent) with_parent parent do parent.children = visit_children_without_parent(parent) parent end end
Keeps track of the current parent node.
visit_children
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit_children_without_parent(node) node.children.map {|c| visit(c)}.flatten end
Like {#visit\_children}, but doesn't set {#parent}. @param node [Sass::Tree::Node] @return [Array<Sass::Tree::Node>] the flattened results of visiting all the children of `node`
visit_children_without_parent
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def with_parent(parent) @parents.push parent yield ensure @parents.pop end
Runs a block of code with the current parent node replaced with the given node. @param parent [Tree::Node] The new parent for the duration of the block. @yield A block in which the parent is set to `parent`. @return [Object] The return value of the block.
with_parent
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit_root(node) yield if parent.nil? imports_to_move = [] import_limit = nil i = -1 node.children.reject! do |n| i += 1 if import_limit next false unless n.is_a?(Sass::Tree::CssImportNode) imports_to_move << n next true end if !n.is_a?(Sass::Tree::CommentNode) && !n.is_a?(Sass::Tree::CharsetNode) && !n.is_a?(Sass::Tree::CssImportNode) import_limit = i end false end if import_limit node.children = node.children[0...import_limit] + imports_to_move + node.children[import_limit..-1] end end return node, @extends rescue Sass::SyntaxError => e e.sass_template ||= node.template raise e end
Converts the entire document to CSS. @return [(Tree::Node, Sass::Util::SubsetMap)] The resulting tree of static nodes *and* the extensions defined for this tree
visit_root
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit_extend(node) parent.resolved_rules.populate_extends(@extends, node.resolved_selector, node, @parents.select {|p| p.is_a?(Sass::Tree::DirectiveNode)}) [] end
Registers an extension in the `@extends` subset map.
visit_extend
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit_import(node) visit_children_without_parent(node) rescue Sass::SyntaxError => e e.modify_backtrace(:filename => node.children.first.filename) e.add_backtrace(:filename => node.filename, :line => node.line) raise e end
Modifies exception backtraces to include the imported file.
visit_import
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit_trace(node) visit_children_without_parent(node) rescue Sass::SyntaxError => e e.modify_backtrace(:mixin => node.name, :filename => node.filename, :line => node.line) e.add_backtrace(:filename => node.filename, :line => node.line) raise e end
Asserts that all the traced children are valid in their new location.
visit_trace
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit_prop(node) if parent.is_a?(Sass::Tree::PropNode) node.resolved_name = "#{parent.resolved_name}-#{node.resolved_name}" node.tabs = parent.tabs + (parent.resolved_value.empty? ? 0 : 1) if node.style == :nested end yield result = node.children.dup if !node.resolved_value.empty? || node.children.empty? node.send(:check!) result.unshift(node) end result end
Converts nested properties into flat properties and updates the indentation of the prop node based on the nesting level.
visit_prop
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit_rule(node) yield rules = node.children.select {|c| bubblable?(c)} props = node.children.reject {|c| bubblable?(c) || c.invisible?} unless props.empty? node.children = props rules.each {|r| r.tabs += 1} if node.style == :nested rules.unshift(node) end rules = debubble(rules) unless parent.is_a?(Sass::Tree::RuleNode) || rules.empty? || !bubblable?(rules.last) rules.last.group_end = true end rules end
The following directives are visible and have children. This means they need to be able to handle bubbling up nodes such as @at-root and @media. Updates the indentation of the rule node based on the nesting level. The selectors were resolved in {Perform}.
visit_rule
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit_media(node) return bubble(node) if parent.is_a?(Sass::Tree::RuleNode) return Bubble.new(node) if parent.is_a?(Sass::Tree::MediaNode) yield debubble(node.children, node) do |child| next child unless child.is_a?(Sass::Tree::MediaNode) # Copies of `node` can be bubbled, and we don't want to merge it with its # own query. next child if child.resolved_query == node.resolved_query next child if child.resolved_query = child.resolved_query.merge(node.resolved_query) end end
Bubbles the `@media` directive up through RuleNodes and merges it with other `@media` directives.
visit_media
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit_supports(node) return node unless node.has_children return bubble(node) if parent.is_a?(Sass::Tree::RuleNode) yield debubble(node.children, node) end
Bubbles the `@supports` directive up through RuleNodes.
visit_supports
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def bubble(node) new_rule = parent.dup new_rule.children = node.children node.children = [new_rule] Bubble.new(node) end
"Bubbles" `node` one level by copying the parent and wrapping `node`'s children with it. @param node [Sass::Tree::Node]. @return [Bubble]
bubble
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def bubblable?(node) node.is_a?(Sass::Tree::RuleNode) || node.bubbles? end
Returns whether or not a node can be bubbled up through the syntax tree. @param node [Sass::Tree::Node] @return [Boolean]
bubblable?
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/cssize.rb
Apache-2.0
def visit(node) super(node) rescue Sass::SyntaxError => e e.modify_backtrace(:filename => node.filename, :line => node.line) raise e end
If an exception is raised, this adds proper metadata to the backtrace.
visit
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/extend.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/extend.rb
Apache-2.0
def visit_children(parent) @parent_directives.push parent if parent.is_a?(Sass::Tree::DirectiveNode) super ensure @parent_directives.pop if parent.is_a?(Sass::Tree::DirectiveNode) end
Keeps track of the current parent directives.
visit_children
ruby
collabnix/kubelabs
.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/extend.rb
https://github.com/collabnix/kubelabs/blob/master/.bundles_cache/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/extend.rb
Apache-2.0