Sha256: a30c5ae8ff70da2639bb94f7c5103ebe1deddafe04c792ef870feca360d43567

Contents?: true

Size: 387 Bytes

Versions: 7

Compression:

Stored size: 387 Bytes

Contents

class StyleStats::Css
  class Selector
    attr_accessor :name, :declarations

    def initialize(name, declarations = [])
      self.name = name
      self.declarations = declarations
    end

    def identifier_count
      trimmed_name = self.name.gsub(/\s?([\>\+\~])\s?/) { $1 }
      trimmed_name.gsub(/\s+/, ' ').split(/\s|\>|\+|\~|\:|[\w\]]\.|[\w\]]\#|\[/).count
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
style_stats-0.4.2 lib/style_stats/css/selector.rb
style_stats-0.4.1 lib/style_stats/css/selector.rb
style_stats-0.4.0 lib/style_stats/css/selector.rb
style_stats-0.3.0 lib/style_stats/css/selector.rb
style_stats-0.2.0 lib/style_stats/css/selector.rb
style_stats-0.1.0 lib/style_stats/css/selector.rb
style_stats-0.0.1 lib/style_stats/css/selector.rb