method
thread_mattr_writer
v5.1.7 -
Show latest stable
-
0 notes -
Class: Module
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1 (0)
- 5.1.7 (21)
- 5.2.3 (0)
- 6.0.0 (-38)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
thread_mattr_writer(*syms)
public
Defines a per-thread class attribute and creates a class and instance writer methods to allow assignment to the attribute.
module Current thread_mattr_writer :user end Current.user = "DHH" Thread.current[:attr_Current_user] # => "DHH"
If you want to opt out of the creation of the instance writer method, pass instance_writer: false or instance_accessor: false.
class Current thread_mattr_writer :user, instance_writer: false end Current.new.user = "DHH" # => NoMethodError