Sha256: 5ee66142b555b76b2e2d67a645c8d8b77f2046fccc0b3a11fe5ae77d987efbbd
Contents?: true
Size: 593 Bytes
Versions: 2
Compression:
Stored size: 593 Bytes
Contents
class SchemaSerializer module Serializable def serializer(*args) options = args.last.is_a?(Hash) ? args.pop : {} klass = args.first || options[:class] (klass || serializer_class || SchemaSerializer).new(self, options) end private def serializer_class SchemaSerializer::Constantizer.find("#{serializer_base_class_name}Serializer") end def serializer_base_class_name return self.class.name unless defined?(ActiveRecord) self.class < ActiveRecord::Relation ? model.name.pluralize : self.class.name end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
schema_serializer-0.2.7 | lib/schema_serializer/serializable.rb |
schema_serializer-0.2.6 | lib/schema_serializer/serializable.rb |