Class: Arbre::HTML::ClassList

Inherits:
Set
  • Object
show all
Defined in:
lib/arbre/html/class_list.rb

Overview

Holds a set of classes

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build_from_string(class_names) ⇒ Object


9
10
11
# File 'lib/arbre/html/class_list.rb', line 9

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

Instance Method Details

#add(class_names) ⇒ Object Also known as: <<


13
14
15
16
17
18
# File 'lib/arbre/html/class_list.rb', line 13

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

#to_sObject


21
22
23
# File 'lib/arbre/html/class_list.rb', line 21

def to_s
  to_a.join(" ")
end