lib/sass/selector/abstract_sequence.rb in sass-3.7.4 vs lib/sass/selector/abstract_sequence.rb in sass-4.0.0.alpha.1

- old
+ new

@@ -6,23 +6,23 @@ # of object that respond to `#line=` and `#filename=`, as well as a `to_s` # method that returns the string representation of the selector. class AbstractSequence # The line of the Sass template on which this selector was declared. # - # @return [Integer] + # @return [Fixnum] attr_reader :line # The name of the file in which this selector was declared. # # @return [String, nil] attr_reader :filename # Sets the line of the Sass template on which this selector was declared. # This also sets the line for all child selectors. # - # @param line [Integer] - # @return [Integer] + # @param line [Fixnum] + # @return [Fixnum] def line=(line) members.each {|m| m.line = line} @line = line end @@ -40,11 +40,11 @@ # Returns a hash code for this sequence. # # Subclasses should define `#_hash` rather than overriding this method, # which automatically handles memoizing the result. # - # @return [Integer] + # @return [Fixnum] def hash @_hash ||= _hash end # Checks equality between this and another object. @@ -57,35 +57,32 @@ def eql?(other) other.class == self.class && other.hash == hash && _eql?(other) end alias_method :==, :eql? - # Whether or not this selector should be hidden due to containing a - # placeholder. - def invisible? - @invisible ||= members.any? do |m| - next m.invisible? if m.is_a?(AbstractSequence) || m.is_a?(Pseudo) + # Whether or not this selector sequence contains a placeholder selector. + # Checks recursively. + def has_placeholder? + @has_placeholder ||= members.any? do |m| + next m.has_placeholder? if m.is_a?(AbstractSequence) + next m.selector && m.selector.has_placeholder? if m.is_a?(Pseudo) m.is_a?(Placeholder) end end # Returns the selector string. # - # @param opts [Hash] rendering options. - # @option opts [Symbol] :style The css rendering style. - # @option placeholders [Boolean] :placeholders - # Whether to include placeholder selectors. Defaults to `true`. # @return [String] - def to_s(opts = {}) + def to_s Sass::Util.abstract(self) end # Returns the specificity of the selector. # # The base is given by {Sass::Selector::SPECIFICITY_BASE}. This can be a # number or a range representing possible specificities. # - # @return [Integer, Range] + # @return [Fixnum, Range] def specificity _specificity(members) end protected