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
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/puppet/concurrent/thread_local_singleton.rb', line 6 def singleton key = (name + ".singleton").intern thread = Thread.current value = thread.thread_variable_get(key) if value.nil? value = new thread.thread_variable_set(key, value) end value end |