Module: Hsdq::ThreadStore

Included in:
Hsdq
Defined in:
lib/hsdq/thread_store.rb

Instance Method Summary collapse

Instance Method Details

#context(data = nil) ⇒ Object

Specialized proxy for set_get the key is the method name

See Also:



6
7
8
# File 'lib/hsdq/thread_store.rb', line 6

def context(data=nil)
  set_get __method__, data
end

#context_params(data = nil) ⇒ Object

Specialized proxy for set_get the key is the method name

See Also:



12
13
14
# File 'lib/hsdq/thread_store.rb', line 12

def context_params(data=nil)
  set_get __method__, data
end

#current_uid(data = nil) ⇒ Object

Specialized proxy for set_get the key is the method name

See Also:



18
19
20
# File 'lib/hsdq/thread_store.rb', line 18

def current_uid(data=nil)
  set_get __method__, data
end

#previous_sender(data = nil) ⇒ Object

Specialized proxy for set_get the key is the method name

See Also:



24
25
26
# File 'lib/hsdq/thread_store.rb', line 24

def previous_sender(data=nil)
  set_get __method__, data
end

#reply_to(data = nil) ⇒ Object

Specialized proxy for set_get the key is the method name

See Also:



36
37
38
# File 'lib/hsdq/thread_store.rb', line 36

def reply_to(data=nil)
  set_get __method__, data
end

#sent_to(data = nil) ⇒ Object

Specialized proxy for set_get the key is the method name

See Also:



30
31
32
# File 'lib/hsdq/thread_store.rb', line 30

def sent_to(data=nil)
  set_get __method__, data
end

#set_get(key, data = nil) ⇒ Stored value

Return the value stored into the corresponding thread.current key only if no data is passed

Parameters:

  • data (any value) (defaults to: nil)

    save data into the corresponding Thread.current key if data is passed

Returns:

  • (Stored value)


43
44
45
46
# File 'lib/hsdq/thread_store.rb', line 43

def set_get(key, data=nil)
  Thread.current[key] = data if data
  Thread.current[key]
end