Class: AuditTracker::Tracker::Callback

Inherits:
Object
  • Object
show all
Defined in:
lib/audit_tracker/tracker.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(value_fn, relation, event) ⇒ Callback

Returns a new instance of Callback.



69
70
71
72
73
# File 'lib/audit_tracker/tracker.rb', line 69

def initialize(value_fn, relation, event)
  @value = value_fn
  @relation = relation
  @event = event
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/audit_tracker/tracker.rb', line 79

def method_missing(method, ...)
  if respond_to_missing?(method)
    call(...)
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method) ⇒ Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/audit_tracker/tracker.rb', line 75

def respond_to_missing?(method)
  method.to_s.eql?("before_#{@event}")
end