Class: Revocare::CallbackData

Inherits:
Object
  • Object
show all
Defined in:
lib/revocare/callback_data.rb

Constant Summary collapse

INTERNAL_MODELS =
[
  "ActiveRecord::InternalMetadata",
  "ActiveRecord::SchemaMigration",
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCallbackData

Returns a new instance of CallbackData.



14
15
16
# File 'lib/revocare/callback_data.rb', line 14

def initialize
  @data = []
end

Class Method Details

.to_aObject



10
11
12
# File 'lib/revocare/callback_data.rb', line 10

def self.to_a
  new.to_a
end

Instance Method Details

#to_aObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/revocare/callback_data.rb', line 18

def to_a
  all_models.each do |model|
    callbacks = callbacks_for(model)

    if callbacks.any?
      data << {
        model: model.name,
        callbacks: format_callbacks(callbacks),
      }
    end
  end

  data
end