module PlainSerializer::Configurable::ClassMethods
Defines required methods for base class
Public Instance Methods
setup(*args)
click to toggle source
Calls superclass method
# File lib/plain_serializer/configurable.rb, line 12 def setup(*args) opts = Helpers.extract_options!(args) attributes = args.each_with_object([]) do |attribute, result| next result << attribute unless group?(attribute) group(attribute).each do |group_attribute| if group_attribute.is_a?(Hash) opts.merge!(group_attribute) else result << group_attribute end end end super(*attributes, **opts) end
Private Instance Methods
define_group(name, attributes)
click to toggle source
# File lib/plain_serializer/configurable.rb, line 32 def define_group(name, attributes) groups[name] = attributes end
group(name)
click to toggle source
# File lib/plain_serializer/configurable.rb, line 40 def group(name) groups[name] end
group?(name)
click to toggle source
# File lib/plain_serializer/configurable.rb, line 44 def group?(name) groups.key?(name) end
groups()
click to toggle source
# File lib/plain_serializer/configurable.rb, line 36 def groups @groups ||= {} end