Module: Royal::Locking

Defined in:
lib/royal/locking.rb,
lib/royal/locking/advisory.rb,
lib/royal/locking/optimistic.rb,
lib/royal/locking/pessimistic.rb

Defined Under Namespace

Classes: Advisory, Optimistic, Pessimistic

Class Method Summary collapse

Class Method Details

.resolve(locator) ⇒ #call

Parameters:

  • locator (Symbol)

Returns:

  • (#call)


11
12
13
14
15
16
17
18
# File 'lib/royal/locking.rb', line 11

def self.resolve(locator)
  case locator
  when :advisory then Advisory.new
  when :optimistic then Optimistic.new
  when :pessimistic then Pessimistic.new
  else raise ArgumentError, "Unsupported locking type: #{locator.inspect}"
  end
end