Module: TurboTest::ConstantTracer::Definition
- Extended by:
- DefinitionTemplates
- Defined in:
- lib/turbo_test_constant_tracer/definition.rb
Constant Summary collapse
- SPECIAL_METHODS =
{ "String" => %i[scan gsub gsub! sub sub!], "Enumerable" => %i[all? any? grep grep_v none? one? slice_before slice_after] }.freeze
- SUPER_SPECIAL_METHODS =
{ "String" => [:=~] }.freeze
Class Method Summary collapse
- .delegator_proxy(klass, name, constant, location) ⇒ Object
- .internal_proxy(klass, name, constant, location) ⇒ Object
Class Method Details
.delegator_proxy(klass, name, constant, location) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/turbo_test_constant_tracer/definition.rb', line 21 def delegator_proxy(klass, name, constant, location) proxy_class = Constructor.new(constant.class).construct proxy_object = proxy_class.new(constant) proxy_object.turbo_test_name = "#{klass}::#{name}" proxy_object.turbo_test_path = location ProxyKlass.proxied_objects[proxy_object.object_id] = true set_class_constant(klass, name, proxy_object) end |
.internal_proxy(klass, name, constant, location) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/turbo_test_constant_tracer/definition.rb', line 12 def internal_proxy(klass, name, constant, location) freeze = constant.frozen? constant = constant.dup if freeze create_internal_proxy_methods(constant, klass, name, location) constant.__turbo_test_tt_proxy_dup_object = constant.dup constant.__send__(:__turbo_test_freeze) if freeze set_class_constant(klass, name, constant) end |