Class: Sunspot::ClassSet
- Inherits:
-
Object
- Object
- Sunspot::ClassSet
- Includes:
- Enumerable
- Defined in:
- lib/sunspot/class_set.rb
Instance Method Summary collapse
- #<<(klass) ⇒ Object (also: #add)
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ ClassSet
constructor
A new instance of ClassSet.
Constructor Details
#initialize ⇒ ClassSet
Returns a new instance of ClassSet.
5 6 7 |
# File 'lib/sunspot/class_set.rb', line 5 def initialize @name_to_klass = {} end |
Instance Method Details
#<<(klass) ⇒ Object Also known as: add
9 10 11 12 |
# File 'lib/sunspot/class_set.rb', line 9 def <<(klass) @name_to_klass[klass.name.to_sym] = klass self end |
#each(&block) ⇒ Object
15 16 17 |
# File 'lib/sunspot/class_set.rb', line 15 def each(&block) @name_to_klass.values.each(&block) end |
#empty? ⇒ Boolean
19 20 21 |
# File 'lib/sunspot/class_set.rb', line 19 def empty? @name_to_klass.empty? end |