class ActiveRepository::Callback::Base
Public Class Methods
new(object, method, options={})
click to toggle source
# File lib/active_repository/callback/base.rb, line 4 def initialize(object, method, options={}) @object = object @method = method @options = options end
Public Instance Methods
call()
click to toggle source
# File lib/active_repository/callback/base.rb, line 10 def call @object.send(@method) if can_run? end
Private Instance Methods
can_run?()
click to toggle source
# File lib/active_repository/callback/base.rb, line 15 def can_run? return @can_run if @can_run if_option = @options[:if].nil? ? true : @object.send(@options[:if]) unless_option = @options[:unless].nil? ? false : @object.send(@options[:unless]) @can_run = if_option && !unless_option end