Class: Tablesalt::ThreadAccessor::ScopedAccessor

Inherits:
Module
  • Object
show all
Defined in:
lib/tablesalt/thread_accessor/scoped_accessor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope) ⇒ ScopedAccessor

Returns a new instance of ScopedAccessor.



8
9
10
11
12
13
14
15
16
# File 'lib/tablesalt/thread_accessor/scoped_accessor.rb', line 8

def initialize(scope)
  @scope = scope

  extend ActiveSupport::Concern
  extend Management
  include ThreadAccessor

  const_set :THREAD_ACCESSOR_STORE_NAMESPACE, scope
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



6
7
8
# File 'lib/tablesalt/thread_accessor/scoped_accessor.rb', line 6

def scope
  @scope
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/tablesalt/thread_accessor/scoped_accessor.rb', line 22

def inspect
  "#<#{name}>"
end

#nameObject



18
19
20
# File 'lib/tablesalt/thread_accessor/scoped_accessor.rb', line 18

def name
  "#{self.class}:#{scope}"
end