Sha256: ae8574183eb75c66b69e0dad258421a0f8769be52fecedd4c6153eb2f4d5bd45
Contents?: true
Size: 515 Bytes
Versions: 7
Compression:
Stored size: 515 Bytes
Contents
module AdminIt module Renderable def render(entity = nil, instance = nil, &block) if entity.nil? && instance.nil? # method used as setter - just save block @renderer = block if block_given? elsif !@renderer.nil? # method used as event emmiter, call block in instance or caller # context if it present if instance.nil? @renderer.call(entity) else instance.instance_exec(entity, &@renderer) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems