Module: PipelineService::Serializers::Fetcher
- Defined in:
- app/services/pipeline_service/serializers/fetcher.rb
Class Method Summary collapse
-
.fetch(object:) ⇒ Object
Will fetch a serializer with the same name as the object parameter.
Class Method Details
.fetch(object:) ⇒ Object
Will fetch a serializer with the same name as the object parameter. Raises a name error if the serializer doesn’t exist. Maps any object with a class containing ‘enrollment’ to the enrollment serializer
7 8 9 10 11 12 13 14 15 16 |
# File 'app/services/pipeline_service/serializers/fetcher.rb', line 7 def self.fetch(object:) case object.class.to_s when /PipelineService::Nouns::UnitGrades/ PipelineService::Serializers::UnitGrades when /Enrollment/ PipelineService::Serializers::Enrollment else "PipelineService::Serializers::#{object.class.to_s}".constantize end end |