Class: Spree::Core::ClassConstantizer::Set
- Inherits:
-
Object
- Object
- Spree::Core::ClassConstantizer::Set
- Includes:
- Enumerable
- Defined in:
- lib/spree/core/class_constantizer.rb
Instance Method Summary collapse
- #<<(klass) ⇒ Object
- #concat(klasses) ⇒ Object
- #delete(object) ⇒ Object
- #each ⇒ Object
-
#initialize(default: []) ⇒ Set
constructor
A new instance of Set.
Constructor Details
#initialize(default: []) ⇒ Set
Returns a new instance of Set.
11 12 13 |
# File 'lib/spree/core/class_constantizer.rb', line 11 def initialize(default: []) @collection = ::Set.new(default) end |
Instance Method Details
#<<(klass) ⇒ Object
15 16 17 |
# File 'lib/spree/core/class_constantizer.rb', line 15 def <<(klass) @collection << klass.to_s end |
#concat(klasses) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/spree/core/class_constantizer.rb', line 19 def concat(klasses) klasses.each do |klass| self << klass end self end |
#delete(object) ⇒ Object
29 30 31 |
# File 'lib/spree/core/class_constantizer.rb', line 29 def delete(object) @collection.delete(object.to_s) end |
#each ⇒ Object
33 34 35 36 37 |
# File 'lib/spree/core/class_constantizer.rb', line 33 def each @collection.each do |klass| yield klass.constantize end end |