Class: ActiveService::Base
- Inherits:
-
Object
- Object
- ActiveService::Base
- Defined in:
- lib/active_service/base.rb
Class Method Summary collapse
Class Method Details
.method_added(method) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/active_service/base.rb', line 5 def self.method_added(method) name = method.to_s return if name =~ /__.*/ || name =~ /.*!/ return if (@__handled_names ||= []).include?(method) @__handled_names << method alias_method :"__#{name}", method alias_method :"#{name}!", method define_method(method) { |*args, &block| ::ActiveRecord::Base.transaction { self.method(:"__#{name}").call(*args, &block) } } end |