Module: Puppet::Concurrent::ThreadLocalSingleton
- Included in:
- Pops::Model::PNTransformer, Pops::Parser::EvaluatingParser, Pops::Serialization::JsonPath::Resolver, Pops::Time::Timespan::FormatParser, Pops::Types::StringConverter, Pops::Types::TypeCalculator, Pops::Types::TypeFormatter, Pops::Types::TypeParser
- Defined in:
- lib/puppet/concurrent/thread_local_singleton.rb
Instance Method Summary collapse
Instance Method Details
#singleton ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/puppet/concurrent/thread_local_singleton.rb', line 4 def singleton key = (name + ".singleton").intern thread = Thread.current unless thread.thread_variable?(key) thread.thread_variable_set(key, new) end thread.thread_variable_get(key) end |