SciRuby / daru-view

daru-view is for easy and interactive plotting in web application & IRuby notebook. daru-view is a plugin gem to the existing daru gem.
https://sciruby.github.io/daru-view/
MIT License
95 stars 20 forks source link

How about implementing the #to_iruby method? #143

Closed kojix2 closed 3 years ago

kojix2 commented 5 years ago

Hi.

I use Daru::View::Plot almost everyday. It is troublesome to write show_in_iruby method every time I plot. I am lazy.

I write a simple ad hoc monkey patch below so that I do not need to write anything.

module Daru::View
  class Plot
      def to_iruby
          representation = show_in_iruby
          [representation.options[:mime], representation.object]
      end
  end

  class PlotList
    def to_iruby
          representation = show_in_iruby
          [representation.options[:mime], representation.object]
    end
  end
end

How about implementing the to_iruby method? There may be some reasons for not being implemented. But I think it is useful.

image

Shekharrajak commented 5 years ago

Thanks @kojix2 , for pointing it out. Sometimes feel the same. If you have any other name for the method, please let us know as well. Yes, it should be implemented and we can make show_in_iruby deprecated in 3.x version.

kojix2 commented 3 years ago

This issue is old and will be closed. IRuby needs improvement...