Sha256: 1cfeee9f62bbe609ac197bc37bfea22f5f04468862932923d354cdadbb9e818e
Contents?: true
Size: 524 Bytes
Versions: 1
Compression:
Stored size: 524 Bytes
Contents
module ApplicationHelper def present(object_or_class, klass = nil) presenter = nil if object_or_class.methods.include?(:new) klass ||= "#{object_or_class}Presenter".constantize presenter = klass presenter.template = self else klass ||= "#{object_or_class.class}Presenter".constantize presenter = klass.new(object_or_class, self) end yield presenter if block_given? #block.arity > 0 ? yield(presenter) : presenter.instance_eval(&block) return presenter end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
base_presenter-0.0.7 | lib/application_helper.rb |