Class: RailsAsyncMigrations::Migration::Lock
- Inherits:
-
Object
- Object
- RailsAsyncMigrations::Migration::Lock
- Defined in:
- lib/rails_async_migrations/migration/lock.rb
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#resource_class ⇒ Object
readonly
Returns the value of attribute resource_class.
Instance Method Summary collapse
-
#initialize(resource_class, method_name) ⇒ Lock
constructor
A new instance of Lock.
- #perform ⇒ Object
- #suspend_lock(&block) ⇒ Object
Constructor Details
#initialize(resource_class, method_name) ⇒ Lock
Returns a new instance of Lock.
9 10 11 12 |
# File 'lib/rails_async_migrations/migration/lock.rb', line 9 def initialize(resource_class, method_name) @resource_class = resource_class @method_name = method_name end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
7 8 9 |
# File 'lib/rails_async_migrations/migration/lock.rb', line 7 def method_name @method_name end |
#resource_class ⇒ Object (readonly)
Returns the value of attribute resource_class.
7 8 9 |
# File 'lib/rails_async_migrations/migration/lock.rb', line 7 def resource_class @resource_class end |
Instance Method Details
#perform ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rails_async_migrations/migration/lock.rb', line 14 def perform return false unless locked_method? return false if unlocked? preserve_method_logics suspend_lock do overwrite_method end end |
#suspend_lock(&block) ⇒ Object
25 26 27 28 29 |
# File 'lib/rails_async_migrations/migration/lock.rb', line 25 def suspend_lock(&block) unlock yield if block_given? lock end |