Class: TurboTest::ConstantTracer::Constructor

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo_test_constant_tracer/constructor.rb

Instance Method Summary collapse

Constructor Details

#initialize(original_class) ⇒ Constructor

Returns a new instance of Constructor.



6
7
8
9
# File 'lib/turbo_test_constant_tracer/constructor.rb', line 6

def initialize(original_class)
  @klass = original_class
  @klass_name = original_class.name.gsub("::", "")
end

Instance Method Details

#constructObject



11
12
13
14
15
16
17
18
19
# File 'lib/turbo_test_constant_tracer/constructor.rb', line 11

def construct
  return ProxyKlass.const_get(@klass_name) if proxy_class_defined?

  Klass.define(@klass, @klass_name).tap do
    prepend_equality_operators_to_original_class
    prepend_equality_operators Numeric
    prepend_equality_operators Comparable
  end
end