lib/serializer.rb
# Loops over all attributes and skips if a condition is defined and falsey
Loops over all attributes and skips if a condition is defined and falsey
Loops over all attributes and skips if a condition is defined and falsey
def to_h
      self.class.attributes.each_with_object({}) do |attribute, obj|
        next if attribute.condition && !public_send(attribute.condition)
        obj[attribute.key] = ValueFetcher.fetch(attribute, object, self)
      end
    end
def to_h self . class . attributes . each_with_object ( { } ) do | attribute , obj | next if attribute . condition && ! public_send ( attribute . condition ) obj [ attribute . key ] = ValueFetcher . fetch ( attribute , object , self ) end end
Loops over all attributes and skips if a condition is defined and falsey
Loops over all attributes and skips if a condition is defined and falsey