Sha256: bb7f2dbd4496ecab9fb725f8678815d263903225f280db993a73997584001ef2
Contents?: true
Size: 600 Bytes
Versions: 29
Compression:
Stored size: 600 Bytes
Contents
# typed: false # Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.com/terms.html require 'sqreen/util' class Sqreen::Util::CappedString < String attr_reader :size_cap def initialize(*args, &block) opts = args.last.is_a?(Hash) ? args.pop : {} size_cap = opts[:size_cap] || 4096 @size_cap = size_cap super(*args, &block) end def <<(value) return self unless size < size_cap value = value[0, size_cap - size] if size + value.size > size_cap super(value) end alias_method :concat, :<< end
Version data entries
29 entries across 29 versions & 1 rubygems