Sha256: fb54c60a08ddd12fcec15bc3dd0ee82b4adb002c800f5dee67f2d03403c0e8aa
Contents?: true
Size: 544 Bytes
Versions: 1
Compression:
Stored size: 544 Bytes
Contents
module ApplicationHelper def present(object_or_class, klass = nil, &block) 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 if block_given? block.arity > 0 ? yield(presenter) : presenter.instance_eval(&block) end return presenter end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
base_presenter-0.0.10 | lib/application_helper.rb |