lib/cocina/models.rb in cocina-models-0.19.0 vs lib/cocina/models.rb in cocina-models-0.20.0
- old
+ new
@@ -34,9 +34,14 @@
module Models
class Error < StandardError; end
# Raised when the type attribute is not valid.
class UnknownTypeError < Error; end
+ # Base class for Cocina Structs
+ class Struct < Dry::Struct
+ transform_keys(&:to_sym)
+ end
+
# @param [Hash] dyn a ruby hash representation of the JSON serialization of a collection or DRO
# @return [DRO,Collection]
# @raises [UnknownTypeError] if a valid type is not found in the data
# @raises [KeyError] if a type field cannot be found in the data
def self.build(dyn)