Module: Wardrobe::Plugins::Presenter::InstanceMethods

Defined in:
lib/wardrobe/plugins/presenter.rb

Instance Method Summary collapse

Instance Method Details

#_present(attributes: nil, **args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/wardrobe/plugins/presenter.rb', line 11

def _present(attributes: nil, **args)
  options = self.class.plugin_store[:presenter][:options].merge(args)
  result = {}
  _attribute_store.store.each do |key, atr|
    if attributes.nil? || (attributes && attributes.key?(key))
      result[key] = send(atr.name)._present(attributes: (attributes[key] if attributes), **options)
    end
  end
  result
end