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.5.15 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.13 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.12 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.10 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.9 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.8 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.7 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.6 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.5 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.4 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.3 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.2 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.1 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.5.0 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.4.9 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.4.8 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.4.7 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.4.5 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.4.4 lib/ibrain/core/class_constantizer.rb
ibrain-core-0.4.3 lib/ibrain/core/class_constantizer.rb