Class: Sass::Selector::Id

Inherits:
Simple
  • Object
show all
Defined in:
lib/sass/selector.rb

Overview

An id selector (e.g. #foo).

Instance Attribute Summary collapse

Attributes inherited from Simple

#filename, #line

Instance Method Summary collapse

Methods inherited from Simple

#eql?, #hash, #inspect, #unify_namespaces

Constructor Details

#initialize(name) ⇒ Id

Returns a new instance of Id.

Parameters:



65
66
67
# File 'lib/sass/selector.rb', line 65

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameArray<String, Sass::Script::Node> (readonly)

The id name.

Returns:



62
63
64
# File 'lib/sass/selector.rb', line 62

def name
  @name
end

Instance Method Details

#to_a

See Also:

  • Selector#to_a


70
71
72
# File 'lib/sass/selector.rb', line 70

def to_a
  ["#", *@name]
end

#unify(sels)

Returns nil if sels contains an Sass::Selector::Id selector with a different name than this one.

See Also:

  • Selector#unify


78
79
80
81
# File 'lib/sass/selector.rb', line 78

def unify(sels)
  return if sels.any? {|sel2| sel2.is_a?(Id) && self.name != sel2.name}
  super
end