Class: Travis::Lock::Postgresql
- Inherits:
-
Struct
- Object
- Struct
- Travis::Lock::Postgresql
- Defined in:
- lib/travis/lock/postgresql.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #exclusive(&block) ⇒ Object
-
#initialize ⇒ Postgresql
constructor
A new instance of Postgresql.
Constructor Details
#initialize ⇒ Postgresql
Returns a new instance of Postgresql.
17 18 19 20 |
# File 'lib/travis/lock/postgresql.rb', line 17 def initialize(*) super fail 'lock name cannot be blank' if name.nil? || name.empty? end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
16 17 18 |
# File 'lib/travis/lock/postgresql.rb', line 16 def name @name end |
#options ⇒ Object
Returns the value of attribute options
16 17 18 |
# File 'lib/travis/lock/postgresql.rb', line 16 def end |
Instance Method Details
#exclusive(&block) ⇒ Object
22 23 24 25 |
# File 'lib/travis/lock/postgresql.rb', line 22 def exclusive(&block) with_timeout { obtain_lock } transactional? ? connection.transaction(&block) : with_release(&block) end |