Sha256: 7a118ee9f4d61a51519a282bae5aa9b56e55cfc964d0b58b5af857dcd29f8375

Contents?: true

Size: 868 Bytes

Versions: 6

Compression:

Stored size: 868 Bytes

Contents

module Less
  module Node
    class Selector < ::String
      include Entity
      
      Selectors = {
        :Descendant    => '',
        :Child         => '>',
        :Adjacent      => '+',
        :PseudoClass   => ':',
        :PseudoElement => '::',
        :Sibling       => '~'
      }
  
      def initialize
        super Selectors[ self.class.to_s.split('::').last.to_sym ]
      end
  
      def self.[] key
        Node.const_get(Selectors.find {|k, v| v == key }.first)
      end
    end

    class Descendant < Selector
      def to_css; " " end
    end

    class Child < Selector
      def to_css; " #{self} " end
    end

    class Adjacent < Selector
      def to_css; " #{self} " end
    end

    class PseudoClass < Selector
      def to_css; self end
    end
    
    class PseudoElement < Selector
      def to_css; self end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
cloudhead-less-1.1.11 lib/less/engine/nodes/selector.rb
cloudhead-less-1.1.12 lib/less/engine/nodes/selector.rb
cloudhead-less-1.1.13 lib/less/engine/nodes/selector.rb
less-1.1.13 lib/less/engine/nodes/selector.rb
less-1.1.11 lib/less/engine/nodes/selector.rb
less-1.1.12 lib/less/engine/nodes/selector.rb