Class: Bronze::Transform

Inherits:
Object
  • Object
show all
Defined in:
lib/bronze/transform.rb

Overview

Abstract class for converting an object to and from a normalized form. This can be a hash for database serialization, an active model object, another object, or any other transformation.

Instance Method Summary collapse

Instance Method Details

#denormalize(_object) ⇒ Object

Converts an object from its normalized form.

Parameters:

  • _object (Object)

    The object to convert.

Returns:

  • (Object)

    The converted object.

Raises:



16
17
18
# File 'lib/bronze/transform.rb', line 16

def denormalize(_object)
  raise Bronze::NotImplementedError.new(self, :denormalize)
end

#normalize(_object) ⇒ Object

Converts an object to its normalized form.

Parameters:

  • _object (Object)

    The entity to convert.

Returns:

  • (Object)

    The converted object.

Raises:



25
26
27
# File 'lib/bronze/transform.rb', line 25

def normalize(_object)
  raise Bronze::NotImplementedError.new(self, :normalize)
end