Sha256: d70157105e598dc8c9fd5748cdad7632119823c77306236439a8f923572fb1ed
Contents?: true
Size: 542 Bytes
Versions: 1
Compression:
Stored size: 542 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.initialize(object_or_class, 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.8 | lib/application_helper.rb |