Class: Naught::NullClassBuilder::Commands::Impersonate Private

Inherits:
Mimic show all
Defined in:
lib/naught/null_class_builder/commands/impersonate.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Build a null class that impersonates a given class

Unlike Mimic, Impersonate makes the null class inherit from the target, so is_a? checks will pass.

Instance Attribute Summary

Attributes inherited from Mimic

#class_to_mimic, #example_instance, #include_dynamic, #include_super, #singleton_class

Attributes inherited from Naught::NullClassBuilder::Command

#builder

Instance Method Summary collapse

Methods inherited from Mimic

#call

Methods inherited from Naught::NullClassBuilder::Command

#call

Constructor Details

#initialize(builder, class_to_impersonate, options = {}) ⇒ Impersonate

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create an impersonate command for a class

Parameters:

  • builder (NullClassBuilder)
  • class_to_impersonate (Class)
  • options (Hash) (defaults to: {})


17
18
19
20
# File 'lib/naught/null_class_builder/commands/impersonate.rb', line 17

def initialize(builder, class_to_impersonate, options = {})
  super
  builder.base_class = class_to_impersonate
end