Sha256: 9679b76d7f32a3a28c06bdb072c016afa3cca2823dc9b6401fe43743eab508d6
Contents?: true
Size: 477 Bytes
Versions: 5
Compression:
Stored size: 477 Bytes
Contents
#require 'rubygems' require 'narray' require 'facets' module NArrayExtensions def pretty_string(opts={}) { :col_header => nil, :row_header => nil }.merge!(opts) ("%-3s" % "#") + opts[:col_header].inject("") { |s, a| s + ("%7s" % a) } + "\n" + self.to_a.inject("%-3s" % opts[:row_header]) { |s, v| if v.is_a? Float s + ("%7.2f" % v) else s + ("%7d" % v) end } end end NArray.send(:include, NArrayExtensions)
Version data entries
5 entries across 5 versions & 2 rubygems