crystal-community / icr

Interactive console for Crystal programming language
MIT License
505 stars 40 forks source link

API for library to show object's summary #37

Closed dylandy closed 7 years ago

dylandy commented 7 years ago

I wonder if there could be any APIs for library to show summary for the object that it create.

For example in irb there are something like :

001 > require "statsample"
     => true
002 > [1,2,3].to_vector
     => #<Daru::Vector(3)>
           0   1
           1   2
           2   3 
greyblake commented 7 years ago

Hey! It's a responsibility of a particular library (in you case it's statsample).

You can implement your own library similar to that one, defining inspect methods on object.

ICR allows you to require external libraries: https://github.com/greyblake/crystal-icr#require-local-files

dylandy commented 7 years ago

Thanks a lot !