Sha256: fdc9b41358536fc1a67b01c51ec32d088aa745655004d0c8dca41ec2512b67df
Contents?: true
Size: 578 Bytes
Versions: 9
Compression:
Stored size: 578 Bytes
Contents
module Callbacks module Restrictor extend ActiveSupport::Concern included do mattr_accessor :initiator self.initiator = true attr_accessor :m define_method callback do |model| return unless initiator begin self.initiator = false self.m = model try :init __send__ "call" ensure self.initiator = true end end end class_methods do def callback "#{name.demodulize.underscore.split('_').last(2).join('_')}" end end end end
Version data entries
9 entries across 9 versions & 1 rubygems