class Grape::Entity::Exposure::FormatterExposure
Attributes
format_with[R]
Public Instance Methods
==(other)
click to toggle source
Calls superclass method
Grape::Entity::Exposure::Base#==
# File lib/grape_entity/exposure/formatter_exposure.rb, line 15 def ==(other) super && @format_with == other.format_with end
dup_args()
click to toggle source
Calls superclass method
Grape::Entity::Exposure::Base#dup_args
# File lib/grape_entity/exposure/formatter_exposure.rb, line 11 def dup_args [*super, format_with] end
setup(format_with)
click to toggle source
# File lib/grape_entity/exposure/formatter_exposure.rb, line 7 def setup(format_with) @format_with = format_with end
value(entity, _options)
click to toggle source
# File lib/grape_entity/exposure/formatter_exposure.rb, line 19 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