Sha256: 2b13b47e6b610757d73351817ba5daa0c2a99044c2133c46533c8f90f6a889d3

Contents?: true

Size: 725 Bytes

Versions: 60

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

require 'active_support/core_ext/module'

module Ibrain
  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

60 entries across 60 versions & 1 rubygems

Version Path
ibrain-core-0.2.9 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.2.8 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.2.7 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.2.6 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.2.5 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.2.4 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.2.3 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.2.2 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.2.1 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.2.0 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.1.9 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.1.8 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.1.7 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.1.6 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.1.5 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.1.4 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.1.3 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.1.2 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.1.1 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.1.0 lib/ibrain/core/class_constantizer.rb