From 5fbf7d93738e971c1f3e47a12b66a77ab643c1d1 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Mon, 14 Oct 2019 21:55:23 +0900 Subject: [PATCH] Set the default format for NArray to 'text/plain'. #197 Thanks to @mrkn --- lib/iruby/display.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/iruby/display.rb b/lib/iruby/display.rb index f7aec84..a457d54 100644 --- a/lib/iruby/display.rb +++ b/lib/iruby/display.rb @@ -170,6 +170,9 @@ def format(mime = nil, &block) end type { Numo::NArray } + format 'text/plain' do |obj| + obj.inspect + end format 'text/latex' do |obj| obj.ndim == 2 ? LaTeX.matrix(obj, obj.shape[0], obj.shape[1]) : @@ -180,6 +183,9 @@ def format(mime = nil, &block) end type { NArray } + format 'text/plain' do |obj| + obj.inspect + end format 'text/latex' do |obj| obj.dim == 2 ? LaTeX.matrix(obj.transpose(1, 0), obj.shape[1], obj.shape[0]) :