lib/surrealist/vars_helper.rb
# Checks if there is a serializer defined for a given class and returns it
#
# @param [Class] klass a class to check
# @param [Symbol] tag a tag associated with serializer
#
# @return [Class | nil]
Checks if there is a serializer defined for a given class and returns it
Checks if there is a serializer defined for a given class and returns it
def find_serializer(klass, tag: nil)
        tag ||= DEFAULT_TAG
        hash = klass.instance_variable_get(SERIALIZER_CLASSES)
        serializer = hash&.fetch(tag.to_sym, nil)
        Surrealist::ExceptionRaiser.raise_unknown_tag!(tag) if serializer.nil? && tag != DEFAULT_TAG
        serializer
      end
def find_serializer ( klass , tag : nil ) tag ||= DEFAULT_TAG hash = klass . instance_variable_get ( SERIALIZER_CLASSES ) serializer = hash &. fetch ( tag . to_sym , nil ) Surrealist :: ExceptionRaiser . raise_unknown_tag! ( tag ) if serializer . nil? && tag != DEFAULT_TAG serializer end
Checks if there is a serializer defined for a given class and returns it
Checks if there is a serializer defined for a given class and returns it
None
Class | nil
klass
<not_specific>
tag
<not_specific>
<not_specific>
tag a tag associated with serializer
tag a tag associated with serializer