Sha256: d3320f445a27d550718c68f3b690c3b25480a5ac35007f3864cf56086dd2bbbf

Contents?: true

Size: 866 Bytes

Versions: 25

Compression:

Stored size: 866 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

25 entries across 25 versions & 5 rubygems

Version Path
cloudhead-less-1.2.0 lib/less/engine/nodes/selector.rb
cloudhead-less-1.2.1 lib/less/engine/nodes/selector.rb
cloudhead-less-1.2.2 lib/less/engine/nodes/selector.rb
cloudhead-less-1.2.3 lib/less/engine/nodes/selector.rb
cloudhead-less-1.2.4 lib/less/engine/nodes/selector.rb
cloudhead-less-1.2.5 lib/less/engine/nodes/selector.rb
cloudhead-less-1.2.7 lib/less/engine/nodes/selector.rb
cloudhead-less-1.2.8 lib/less/engine/nodes/selector.rb
lesslateral-1.2.21 lib/less/engine/nodes/selector.rb
less-1.2.21 lib/less/engine/nodes/selector.rb
less-1.2.20 lib/less/engine/nodes/selector.rb
unboxed-less-1.2.19 lib/less/engine/nodes/selector.rb
railsdog-less-1.2.17 lib/less/engine/nodes/selector.rb
less-1.2.19 lib/less/engine/nodes/selector.rb
less-1.2.18 lib/less/engine/nodes/selector.rb
less-1.2.17 lib/less/engine/nodes/selector.rb
less-1.2.16 lib/less/engine/nodes/selector.rb
less-1.2.15 lib/less/engine/nodes/selector.rb
less-1.2.14 lib/less/engine/nodes/selector.rb
less-1.2.13 lib/less/engine/nodes/selector.rb