Class: PostHog::Utils::SizeLimitedHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/posthog/utils.rb

Instance Method Summary collapse

Constructor Details

#initialize(max_length) ⇒ SizeLimitedHash

Returns a new instance of SizeLimitedHash.



149
150
151
152
# File 'lib/posthog/utils.rb', line 149

def initialize(max_length, ...)
  super(...)
  @max_length = max_length
end

Instance Method Details

#[]=(key, value) ⇒ Object



154
155
156
157
# File 'lib/posthog/utils.rb', line 154

def []=(key, value)
  clear if length >= @max_length
  super
end