Module: Wayfarer::Locals Private

Included in:
Job
Defined in:
lib/wayfarer/locals.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


19
20
21
# File 'lib/wayfarer/locals.rb', line 19

def self.included(base)
  base.extend(ClassMethods)
end

.thread_safe_counterpart(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


8
9
10
11
12
13
14
15
16
17
# File 'lib/wayfarer/locals.rb', line 8

def self.thread_safe_counterpart(value)
  case value
  when Array      then Concurrent::Array.new(value)
  when Hash       then Concurrent::Hash[value]
  when TrueClass  then Concurrent::AtomicBoolean.new(value)
  when FalseClass then Concurrent::AtomicBoolean.new(value)
  when Integer then Concurrent::AtomicFixnum.new(value)
  else value
  end
end