Method: Flyweight#register!

Defined in:
lib/exegesis/flyweight.rb

#register!(instance) ⇒ Object

Register an instance in the flyweight. Throw an error if the key is already used.

Parameters:

  • instance (Object)

    the instance to register in the flyweight

Returns:

  • (Object)

    the instance given

Raises:



37
38
39
40
# File 'lib/exegesis/flyweight.rb', line 37

def register!(instance)
  raise AlreadyRegisteredError if has_key?(instance)
  register(instance)
end