Method: Castkit::DataObject#to_hash

Defined in:
lib/castkit/data_object.rb

#to_hash(visited: nil) ⇒ Hash Also known as: to_h, serialize

Serializes the DTO to a Ruby hash.

Parameters:

  • visited (Set, nil) (defaults to: nil)

    used to track circular references

Returns:

  • (Hash)


105
106
107
# File 'lib/castkit/data_object.rb', line 105

def to_hash(visited: nil)
  serializer.call(self, visited: visited)
end