Class: Spree::Core::ClassConstantizer::Set

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/spree/core/class_constantizer.rb

Instance Method Summary collapse

Constructor Details

#initializeSet

Returns a new instance of Set.



9
10
11
# File 'lib/spree/core/class_constantizer.rb', line 9

def initialize
  @collection = ::Set.new
end

Instance Method Details

#<<(klass) ⇒ Object



13
14
15
# File 'lib/spree/core/class_constantizer.rb', line 13

def <<(klass)
  @collection << klass.to_s
end

#concat(klasses) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/spree/core/class_constantizer.rb', line 17

def concat(klasses)
  klasses.each do |klass|
    self << klass
  end

  self
end

#delete(object) ⇒ Object



27
28
29
# File 'lib/spree/core/class_constantizer.rb', line 27

def delete(object)
  @collection.delete(object.to_s)
end

#eachObject



31
32
33
34
35
# File 'lib/spree/core/class_constantizer.rb', line 31

def each
  @collection.each do |klass|
    yield klass.constantize
  end
end