Sha256: 84b648a45ec34af62328385325d82499abf84d4cb17bd90cf8d69cace04b76ed

Contents?: true

Size: 613 Bytes

Versions: 60

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

require 'ibrain/core/class_constantizer'

module Ibrain
  module Core
    module EnvironmentExtension
      extend ActiveSupport::Concern

      class_methods do
        def add_class_set(name)
          define_method(name) do
            set = instance_variable_get("@#{name}")
            set ||= send("#{name}=", [])
            set
          end

          define_method("#{name}=") do |klasses|
            set = ClassConstantizer::Set.new
            set.concat(klasses)
            instance_variable_set("@#{name}", set)
          end
        end
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
ibrain-core-0.4.2 lib/ibrain/core/environment_extension.rb
ibrain-core-0.4.1 lib/ibrain/core/environment_extension.rb
ibrain-core-0.4.0 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.9 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.8 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.7.rc.pre.1 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.7 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.6.pre.rc.1 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.6 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.5 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.4 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.3.pre.rc.2 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.3.pre.rc.1 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.3 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.2.pre.rc.4 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.2.pre.rc.3 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.2.pre.rc lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.2 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.1 lib/ibrain/core/environment_extension.rb
ibrain-core-0.3.0 lib/ibrain/core/environment_extension.rb