Sha256: 3b53a62ed51208256e2343d73f48f600bb98b9b95e84603f18e590e161ef6fc8
Contents?: true
Size: 550 Bytes
Versions: 23
Compression:
Stored size: 550 Bytes
Contents
class RestPack::Serializer::Factory def self.create(*identifiers) serializers = identifiers.map { |identifier| self.classify(identifier) } serializers.count == 1 ? serializers.first : serializers end private def self.classify(identifier) normalised_identifier = identifier.to_s.downcase [normalised_identifier, normalised_identifier.singularize].each do |format| klass = RestPack::Serializer.class_map[format] return klass.new if klass end raise "Invalid RestPack::Serializer : #{identifier}" end end
Version data entries
23 entries across 23 versions & 1 rubygems