Sha256: b829479acb041c5308976bdd537179708b22a9f27624b0cc9fb7cb5965e96156

Contents?: true

Size: 1 KB

Versions: 64

Compression:

Stored size: 1 KB

Contents

# encoding: ascii-8bit

# Copyright 2014 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 General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt

# COSMOS 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

64 entries across 64 versions & 1 rubygems

Version Path
cosmos-4.5.2-java lib/cosmos/core_ext/hash.rb
cosmos-4.5.2 lib/cosmos/core_ext/hash.rb
cosmos-4.5.1-java lib/cosmos/core_ext/hash.rb
cosmos-4.5.1 lib/cosmos/core_ext/hash.rb
cosmos-4.5.0-java lib/cosmos/core_ext/hash.rb
cosmos-4.5.0 lib/cosmos/core_ext/hash.rb
cosmos-4.4.2-java lib/cosmos/core_ext/hash.rb
cosmos-4.4.2 lib/cosmos/core_ext/hash.rb
cosmos-4.4.1-java lib/cosmos/core_ext/hash.rb
cosmos-4.4.1 lib/cosmos/core_ext/hash.rb
cosmos-4.4.0-java lib/cosmos/core_ext/hash.rb
cosmos-4.4.0 lib/cosmos/core_ext/hash.rb
cosmos-4.3.0-java lib/cosmos/core_ext/hash.rb
cosmos-4.3.0 lib/cosmos/core_ext/hash.rb
cosmos-4.2.4-java lib/cosmos/core_ext/hash.rb
cosmos-4.2.4 lib/cosmos/core_ext/hash.rb
cosmos-4.2.3-java lib/cosmos/core_ext/hash.rb
cosmos-4.2.3 lib/cosmos/core_ext/hash.rb
cosmos-4.2.2-java lib/cosmos/core_ext/hash.rb
cosmos-4.2.2 lib/cosmos/core_ext/hash.rb