Class: RailsAsyncMigrations::Mutators::TriggerCallback

Inherits:
Base
  • Object
show all
Defined in:
lib/rails_async_migrations/mutators/trigger_callback.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#current_migration, #fetch_from_file, #migration_class

Constructor Details

#initialize(instance, method_name) ⇒ TriggerCallback

Returns a new instance of TriggerCallback.



6
7
8
9
# File 'lib/rails_async_migrations/mutators/trigger_callback.rb', line 6

def initialize(instance, method_name)
  @instance = instance
  @method_name = method_name
end

Instance Attribute Details

#instanceObject (readonly)

Returns the value of attribute instance.



4
5
6
# File 'lib/rails_async_migrations/mutators/trigger_callback.rb', line 4

def instance
  @instance
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



4
5
6
# File 'lib/rails_async_migrations/mutators/trigger_callback.rb', line 4

def method_name
  @method_name
end

Instance Method Details

#performObject

this method can be called multiple times (we should see what manages this actually) if you use up down and change it’ll be called 3 times for example



13
14
15
16
17
18
19
20
21
# File 'lib/rails_async_migrations/mutators/trigger_callback.rb', line 13

def perform
  unless active_record.allowed_direction?
    Tracer.new.verbose "Direction `#{direction}` not allowed."
    return
  end

  enqueue_asynchronous unless already_enqueued?
  check_queue
end