Sha256: b3df9bb58bab058a854406dc24e3137a5d751d075b46f7d4fe58d4777efdd11c
Contents?: true
Size: 645 Bytes
Versions: 4
Compression:
Stored size: 645 Bytes
Contents
module StrongPresenter # @private class PresenterAssociation def initialize(association, options, &block) options.assert_valid_keys(:with, :scope) @association = association @scope = options.delete(:scope) @block = block @factory = StrongPresenter::Factory.new(options) end def wrap(parent) associated = parent.send(:object).send(association) associated = associated.send(scope) if scope factory.wrap(associated) do |presenter| parent.instance_exec presenter, &@block if @block end end private attr_reader :factory, :association, :scope end end
Version data entries
4 entries across 4 versions & 1 rubygems