Sha256: 66184750036c89ba3a6df2b3ff33ea51a39348a0977b78bf33ee03291730e7d3
Contents?: true
Size: 788 Bytes
Versions: 29
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true module PagesCore module Templates module ControllerActions extend ActiveSupport::Concern module ClassMethods def template_actions @template_actions ||= Hash.new { |hash, key| hash[key] = [] } end def template(*names, &block) Array(names).each do |name| name = name.to_s unless name == :all template_actions[name] << block end end def template_actions_for(name) template_actions[:all] + template_actions[name.to_s] end end def run_template_actions_for(template, *args) self.class.template_actions_for(template).each do |proc| instance_exec(*args, &proc) end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems