Sha256: 56ed7fc05ea0fb2b8fadffcaead58e45193781e8946018386e98b72c9992e481
Contents?: true
Size: 542 Bytes
Versions: 1
Compression:
Stored size: 542 Bytes
Contents
# 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) @format ||= name end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
basic_serializer-0.1.2 | lib/basic_serializer/dsl.rb |