Module: Console1984::Ext::Core::String

Extended by:
ActiveSupport::Concern
Includes:
Freezeable
Defined in:
lib/console1984/ext/core/string.rb

Overview

Prevents loading forbidden classes dynamically.

See extension to Console1984::Ext::Core::Object#const_get.

Instance Method Summary collapse

Methods included from Freezeable

freeze_all, included

Instance Method Details

#constantizeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/console1984/ext/core/string.rb', line 10

def constantize
  if Console1984.command_executor.from_irb?(caller)
    begin
      Console1984.command_executor.validate_command("class #{self}; end")
      super
    rescue Console1984::Errors::ForbiddenCommandAttempted
      raise
    rescue StandardError
      super
    end
  else
    super
  end
end