Module: InstanceTracker::Trackable::InstanceMethods

Defined in:
lib/instance_tracker/trackable.rb

Instance Method Summary collapse

Instance Method Details

#trackableCleanRoom

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.

The instance of CleanRoom is memoised and returned accordingly.

Returns:

Raises:

  • (NotImplementedError)

    if the instance variable tracked has not been defined within the included _klass.



39
40
41
42
43
44
45
# File 'lib/instance_tracker/trackable.rb', line 39

def trackable
  @trackable ||= begin
    entity = instance_variable_get(:"@#{singleton_class.trackable_instance}")
    raise NotImplementedError unless entity
    Class.new(CleanRoom).new(entity)
  end
end

#trackable_instanceObject

Returns the instance tracked by CleanRoom



49
50
51
# File 'lib/instance_tracker/trackable.rb', line 49

def trackable_instance
  trackable.instance
end