Sha256: ce9299ad8e4ebf79d61b012b7494022952d350d4812e582882c0a27191319174

Contents?: true

Size: 724 Bytes

Versions: 64

Compression:

Stored size: 724 Bytes

Contents

# frozen_string_literal: true

require 'active_support/core_ext/module'

module Spree
  module Core
    module ClassConstantizer
      class Set
        include Enumerable

        def initialize
          @collection = ::Set.new
        end

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

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

          self
        end

        delegate :clear, :empty?, to: :@collection

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

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

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
solidus_core-4.3.4 lib/spree/core/class_constantizer.rb
solidus_core-4.2.4 lib/spree/core/class_constantizer.rb
solidus_core-4.1.5 lib/spree/core/class_constantizer.rb
solidus_core-4.3.3 lib/spree/core/class_constantizer.rb
solidus_core-4.3.2 lib/spree/core/class_constantizer.rb
solidus_core-4.1.4 lib/spree/core/class_constantizer.rb
solidus_core-4.3.1 lib/spree/core/class_constantizer.rb
solidus_core-4.3.0 lib/spree/core/class_constantizer.rb
solidus_core-4.2.3 lib/spree/core/class_constantizer.rb
solidus_core-4.1.3 lib/spree/core/class_constantizer.rb
solidus_core-4.0.4 lib/spree/core/class_constantizer.rb
solidus_core-3.4.6 lib/spree/core/class_constantizer.rb
solidus_core-4.0.3 lib/spree/core/class_constantizer.rb
solidus_core-4.1.2 lib/spree/core/class_constantizer.rb
solidus_core-4.2.2 lib/spree/core/class_constantizer.rb
solidus_core-3.4.5 lib/spree/core/class_constantizer.rb
solidus_core-4.2.1 lib/spree/core/class_constantizer.rb
solidus_core-4.2.0 lib/spree/core/class_constantizer.rb
solidus_core-4.1.1 lib/spree/core/class_constantizer.rb
solidus_core-4.0.2 lib/spree/core/class_constantizer.rb