Class: UpAndAtThem::Commit
- Inherits:
-
Object
- Object
- UpAndAtThem::Commit
- Defined in:
- lib/up_and_at_them.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(&block) ⇒ Commit
constructor
A new instance of Commit.
- #on_rollback(&block) ⇒ Object
- #rollback ⇒ Object
Constructor Details
#initialize(&block) ⇒ Commit
Returns a new instance of Commit.
5 6 7 8 |
# File 'lib/up_and_at_them.rb', line 5 def initialize(&block) raise LocalJumpError unless block_given? @block = block end |
Instance Method Details
#call ⇒ Object
14 15 16 |
# File 'lib/up_and_at_them.rb', line 14 def call @block.call end |
#on_rollback(&block) ⇒ Object
9 10 11 12 13 |
# File 'lib/up_and_at_them.rb', line 9 def on_rollback(&block) raise LocalJumpError unless block_given? @rollback = block self end |
#rollback ⇒ Object
17 18 19 |
# File 'lib/up_and_at_them.rb', line 17 def rollback @rollback.call if @rollback end |