Sha256: 70b4b81ef8f090fa25196102c2e980d011eb510ef2d2c6d962e6e06282751752

Contents?: true

Size: 421 Bytes

Versions: 3

Compression:

Stored size: 421 Bytes

Contents

require 'set'

module Arbo
  module HTML

    # Holds a set of classes
    class ClassList < Set

      def self.build_from_string(class_names)
        new.add(class_names)
      end

      def add(class_names)
        class_names.to_s.split(" ").each do |class_name|
          super(class_name)
        end
        self
      end
      alias :<< :add

      def to_s
        to_a.join(" ")
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arbo-1.3.1 lib/arbo/html/class_list.rb
arbo-1.3.0 lib/arbo/html/class_list.rb
arbo-1.2.0 lib/arbo/html/class_list.rb