class Glossarist::Designations::Base
Attributes
designation[RW]
@note This is not entirely aligned with agreed schema and may be
changed.
geographical_area[RW]
normative_status[RW]
Public Class Methods
from_h(hash)
click to toggle source
Calls superclass method
# File lib/glossarist/designations.rb, line 16 def self.from_h(hash) type = hash["type"] if type.nil? || /\w/ !~ type raise ArgumentError, "designation type is missing" end designation_subclass = SERIALIZED_TYPES[type] if self == Base # called on Base class, delegate it to proper subclass SERIALIZED_TYPES[type].from_h(hash) else # called on subclass, instantiate object unless SERIALIZED_TYPES[self] == type raise ArgumentError, "unexpected designation type: #{type}" end super(hash.reject { |k, _| k == "type" }) end end