Sha256: 26493749eaa0cc092d8c42c38c3a90366f1cc807cbf71f370bd158f85e8434b1

Contents?: true

Size: 565 Bytes

Versions: 6

Compression:

Stored size: 565 Bytes

Contents

module Apropos
  # ClassList wraps a list of CSS class selectors with several abilities:
  # - Can be combined with other ClassLists
  # - Can be compared to MediaQuery or ClassList objects via #sort_value, #type
  # - Can be converted to CSS output
  class ClassList
    attr_reader :list, :sort_value

    def initialize(list, sort_value=0)
      @list = list
      @sort_value = sort_value
    end

    def combine(other)
      self.class.new(list + other.list)
    end

    def to_css
      list.join(', ')
    end

    def type
      "class"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
apropos-0.2.0 lib/apropos/class_list.rb
apropos-0.1.4 lib/apropos/class_list.rb
apropos-0.1.3 lib/apropos/class_list.rb
apropos-0.1.2 lib/apropos/class_list.rb
apropos-0.1.1 lib/apropos/class_list.rb
apropos-0.1.0 lib/apropos/class_list.rb