# frozen_string_literal: true class BasicSerializer module DSL def attributes @attributes ||= {} end def attribute(name, type) attributes[name] = type return if method_defined?(name) define_method(name) { object.send(name) } end def model_name(name) @model_name ||= name end def custom_model_name @model_name || name.gsub("Serializer", "") end def schema_ref(ref) @schema_ref ||= ref end def format(name, pretty: false) @format ||= { name: name, pretty: pretty } end end end