Class: Glossarist::Designation::Base
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Glossarist::Designation::Base
- Defined in:
- lib/glossarist/designation/base.rb
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.of_yaml(hash, options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/glossarist/designation/base.rb', line 17 def self.of_yaml(hash, = {}) type = hash["type"] if type.nil? || /\w/ !~ type raise ArgumentError, "designation type is missing" end if self == Base # called on Base class, delegate it to proper subclass SERIALIZED_TYPES[type].of_yaml(hash) else # called on subclass, instantiate object unless SERIALIZED_TYPES[self] == type raise ArgumentError, "unexpected designation type: #{type}" end super(hash, ) end end |