Sha256: 27aec02f7f3b3fea89c4e24ee6a0ebec55ed9d336a70d384ea703ad464927fa4
Contents?: true
Size: 655 Bytes
Versions: 1
Compression:
Stored size: 655 Bytes
Contents
module Presenters module Helper def present(*args, &block) Helper.present(*args, &block) end def present_each(instances, class_type = nil, &block) instances.each do |instance| present(instance, class_type, &block) end end def presenters(instances, class_type = nil) instances.map do |instance| present(instance) end end def self.present(instance, class_type = nil, &block) class_type = class_type || Object.const_get("#{instance.class}Presenter") presenter = class_type.new(instance) yield(presenter) if block_given? return presenter end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
presenters-0.2.0 | lib/presenters/helper.rb |