Class: TurboTest::ConstantTracer::Klass

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

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

STRING_METHODS =
{
  scan: true, gsub: true, gsub!: true, sub: true, sub!: true, "=~": 1
}.freeze
ENUMERABLE_METHODS =
{
  all?: true, any?: true, grep: true, grep_v: true,
  none?: true, one?: true, slice_before: true, slice_after: true
}.freeze
REGEXP_METHODS =
{
  match: 1, "=~": 1, "===": 1
}.freeze

Class Method Summary collapse

Class Method Details

.define(original_class, name) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/turbo_test_constant_tracer/klass.rb', line 23

def self.define(original_class, name)
  return ::TurboTest::ConstantTracer::Regexp if original_class == ::Regexp

  klass = Class.new(TurboTestDelegateClass(original_class)) do
    include InstanceMethods
    extend  ClassMethods
  end
  klass.turbo_test_proxied_class = original_class
  ProxyKlass.const_set name, klass
  klass
end