Sha256: 981b1f53c8a0ad9ee3ee27290f35816049b0e9ecdd5539106d18305c67612c61
Contents?: true
Size: 1002 Bytes
Versions: 23
Compression:
Stored size: 1002 Bytes
Contents
# frozen_string_literal: true module Praxis module Callbacks extend ::ActiveSupport::Concern included do class_attribute :before_callbacks, :after_callbacks, :around_callbacks self.before_callbacks = ({}) self.after_callbacks = ({}) self.around_callbacks = ({}) end module ClassMethods def before(*stage_path, **conditions, &block) stage_path = [:action] if stage_path.empty? before_callbacks[stage_path] ||= [] before_callbacks[stage_path] << [conditions, block] end def after(*stage_path, **conditions, &block) stage_path = [:action] if stage_path.empty? after_callbacks[stage_path] ||= [] after_callbacks[stage_path] << [conditions, block] end def around(*stage_path, **conditions, &block) stage_path = [:action] if stage_path.empty? around_callbacks[stage_path] ||= [] around_callbacks[stage_path] << [conditions, block] end end end end
Version data entries
23 entries across 23 versions & 1 rubygems
Version | Path |
---|---|
praxis-2.0.pre.21 | lib/praxis/callbacks.rb |
praxis-2.0.pre.20 | lib/praxis/callbacks.rb |
praxis-2.0.pre.19 | lib/praxis/callbacks.rb |