Class: Less::Node::Selector

Inherits:
String
  • Object
show all
Includes:
Entity
Defined in:
lib/less/engine/nodes/selector.rb

Direct Known Subclasses

Adjacent, Child, Descendant, PseudoClass, PseudoElement

Constant Summary collapse

Selectors =
{
  :Descendant    => '',
  :Child         => '>',
  :Adjacent      => '+',
  :PseudoClass   => ':',
  :PseudoElement => '::',
  :Sibling       => '~'
}

Instance Attribute Summary

Attributes included from Entity

#parent

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Entity

#inspect, #path, #root, #to_css, #to_s

Constructor Details

#initializeSelector

Returns a new instance of Selector.



15
16
17
# File 'lib/less/engine/nodes/selector.rb', line 15

def initialize
  super Selectors[ self.class.to_s.split('::').last.to_sym ]
end

Class Method Details

.[](key) ⇒ Object



19
20
21
# File 'lib/less/engine/nodes/selector.rb', line 19

def self.[] key
  Node.const_get(Selectors.find {|k, v| v == key }.first)
end