Sha256: 9ce1371ffb450761889cd667bf98cfd24d52f99825d08f1c26bbf6a06b3303d6

Contents?: true

Size: 422 Bytes

Versions: 9

Compression:

Stored size: 422 Bytes

Contents

require 'set'

module Arbre
  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

9 entries across 9 versions & 2 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/arbre-1.4.0/lib/arbre/html/class_list.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/arbre-1.4.0/lib/arbre/html/class_list.rb
arbre-1.4.0 lib/arbre/html/class_list.rb
arbre-1.3.0 lib/arbre/html/class_list.rb
arbre-1.2.1 lib/arbre/html/class_list.rb
arbre-1.2.0 lib/arbre/html/class_list.rb
arbre-1.2.0.rc1 lib/arbre/html/class_list.rb
arbre-1.1.1 lib/arbre/html/class_list.rb
arbre-1.0.3 lib/arbre/html/class_list.rb