Class: TZInfo::StringDeduper Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
TZInfo::ConcurrentStringDeduper
|
|
Inherits: | Object |
Defined in: | lib/tzinfo/string_deduper.rb |
Overview
Maintains a pool of String
instances. The #dedupe method will return
either a pooled copy of a given String
or add the instance to the pool.
Class Attribute Summary
- .global ⇒ StringDeduper readonly Internal use only
Class Method Summary
-
.new ⇒ StringDeduper
constructor
Internal use only
Initializes a new
StringDeduper
.
Instance Method Summary
- #dedupe(string) ⇒ bool Internal use only
-
#create_hash(&block) ⇒ Hash
protected
Internal use only
Creates a
Hash
to store pooledString
instances.
Class Attribute Details
.global ⇒ StringDeduper
(readonly)
# File 'lib/tzinfo/string_deduper.rb', line 16
attr_reader :global
Instance Method Details
#create_hash(&block) ⇒ Hash
(protected)
Creates a Hash
to store pooled String
instances.
# File 'lib/tzinfo/string_deduper.rb', line 41
def create_hash(&block) Hash.new(&block) end
#dedupe(string) ⇒ bool
# File 'lib/tzinfo/string_deduper.rb', line 30
def dedupe(string) return string if string.frozen? @strings[string] end