Class: ActiveJob::Locking::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/activejob/locking/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Options

Returns a new instance of Options.



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

def initialize(options = {})
  @adapter = options[:adapter]
  @hosts = options[:hosts]
  @lock_time = options[:lock_time]
  @lock_acquire_time = options[:lock_acquire_time]
  @adapter_options = options[:adapter_options]
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



6
7
8
# File 'lib/activejob/locking/options.rb', line 6

def adapter
  @adapter
end

#adapter_optionsObject

Returns the value of attribute adapter_options.



10
11
12
# File 'lib/activejob/locking/options.rb', line 10

def adapter_options
  @adapter_options
end

#hostsObject

Returns the value of attribute hosts.



7
8
9
# File 'lib/activejob/locking/options.rb', line 7

def hosts
  @hosts
end

#lock_acquire_timeObject

Returns the value of attribute lock_acquire_time.



9
10
11
# File 'lib/activejob/locking/options.rb', line 9

def lock_acquire_time
  @lock_acquire_time
end

#lock_timeObject

Returns the value of attribute lock_time.



8
9
10
# File 'lib/activejob/locking/options.rb', line 8

def lock_time
  @lock_time
end

Instance Method Details

#merge(other) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/activejob/locking/options.rb', line 46

def merge(other)
  result = self.dup
  result.adapter = other.adapter if other.adapter
  result.hosts = other.hosts if other.hosts
  result.lock_time = other.lock_time if other.lock_time
  result.lock_acquire_time = other.lock_acquire_time if other.lock_acquire_time
  result.adapter_options = other.adapter_options if other.adapter_options
  result
end