Sha256: 62572dc5650629403cf799d3c62b518f100aa0b55c5f54634199cb22a63f5238
Contents?: true
Size: 1.35 KB
Versions: 6
Compression:
Stored size: 1.35 KB
Contents
# encoding: ascii-8bit # Copyright 2022 Ball Aerospace & Technologies Corp. # All Rights Reserved. # # This program is free software; you can modify and/or redistribute it # under the terms of the GNU Affero General Public License # as published by the Free Software Foundation; version 3 with # attribution addendums as found in the LICENSE.txt # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # Modified by OpenC3, Inc. # All changes Copyright 2022, OpenC3, Inc. # All Rights Reserved # OpenC3 specific additions to the Ruby Hash class class Hash # Redefine inspect to only print for small numbers of # items. Prevents exceptions taking forever to be raised with # large objects. See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/105145 alias old_inspect inspect # @param max_elements [Integer] The maximum number of elements in the Hash to # print out before simply displaying the Hash class and object id # @return [String] String representation of the hash def inspect(max_elements = 10) if self.length <= max_elements old_inspect() else '#<' + self.class.to_s + ':' + self.object_id.to_s + '>' end end end
Version data entries
6 entries across 6 versions & 1 rubygems