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