Class: NullObjectModels::NullClassDelegator

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/null_object_models/null_class_delegator.rb

Overview

The purpose of this class is to provide a class that can call a model’s class methods through a NullObjectModel::Default instance without obscuring that this was called through a NullObjectModel::Default instance.

ie. The original implementation was to just override ‘.class` in NullObjectModel::Default, but you do not want to inspect a NullObjectModel and be tricked into thinking it’s a non-null instance of the model

Instance Method Summary collapse

Constructor Details

#initialize(null_object_instance) ⇒ NullClassDelegator

Returns a new instance of NullClassDelegator.



12
13
14
15
# File 'lib/null_object_models/null_class_delegator.rb', line 12

def initialize(null_object_instance)
  super(null_object_instance._nom_klass)
  @_nom_null_object_instance = null_object_instance
end