lib/nmatrix_extensions.rb in semin-ulla-0.9.9 vs lib/nmatrix_extensions.rb in semin-ulla-0.9.9.1

- old
+ new

@@ -1,8 +1,7 @@ require 'rubygems' require 'narray' -require 'facets' begin require 'rvg/rvg' include Magick rescue Exception => e @@ -17,10 +16,10 @@ :row_header => nil, :col_size => 7}.merge(options) ("%-3s" % "#") + opts[:col_header].inject("") { |s, a| s + ("%#{opts[:col_size]}s" % a) - } + "\n" + self.to_a.map_with_index { |a, i| + } + "\n" + self.to_a.each_with_index.map { |a, i| ("%-3s" % opts[:row_header][i]) + a.inject("") { |s, v| if v.is_a? Float s + ("%#{opts[:col_size]}.2f" % v) else s + ("%#{opts[:col_size]}d" % v)