Sha256: c1e7d402f9f496a17276564fe9df5865d67470cb0a675501209ca771ed9be3cc
Contents?: true
Size: 697 Bytes
Versions: 5
Compression:
Stored size: 697 Bytes
Contents
module Grape class Entity module Exposure class FormatterExposure < Base attr_reader :format_with def setup(format_with) @format_with = format_with end def dup_args [*super, format_with] end def ==(other) super && @format_with == other.format_with end def value(entity, _options) formatters = entity.class.formatters if formatters[@format_with] entity.exec_with_attribute(attribute, &formatters[@format_with]) else entity.send(@format_with, entity.delegate_attribute(attribute)) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems