Sha256: 4c7c3556c7d8dccdcab30f17ed5a10e923985d7c3088ca1e4814dd8c97105b2a

Contents?: true

Size: 771 Bytes

Versions: 1

Compression:

Stored size: 771 Bytes

Contents

require 'css_parser_master/declaration_api'

module CssParserMaster
  class Selector
    include CssParserMaster::DeclarationAPI

    attr_accessor :selector, :declarations, :specificity
    
    def initialize(selector, declarations, specificity)
      @selector = selector
      @order = 0     
      @declarations = {}
      parse_declarations!(declarations)  
      # puts "init @declarations: #{@declarations}"
      @specificity = specificity 
    end

    def declarations_to_s(options = {})
      # puts "declarations_to_s: #{declarations.inspect}"
      s = declarations.map do |decl| 
        decl[1].to_text
      end.join('')
      # puts "res: #{s}"
      s
    end

    
    def to_text
      "#{selector}\n{\n#{declarations_to_s}\n} \n"
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
css_parser_master-1.2.4 lib/css_parser_master/selector.rb