21

Does an (experimental) class browser exist for Ruby?

I am talking about a class browser/editor combination similar to that of most Smalltalk implementations (i.e. focused on [runtime] classes/objects instead of .rb files)

Squeak Smalltalk Class Browser

P.S.: it looks like pry is already able to do a lot of the things that would be needed by a smalltalk style class browser? https://speakerdeck.com/u/rahult/p/pry-an-irb-alternative-on-steroids

P.S.2: Looks like the Seaside Smalltalk framework has a web browser based class browser

P.S.3: MagLev/Webtools is the closest I have found yet:

enter image description here

P.S.4: Apparently http://tibleiz.net/code-browser/index.html has Ruby support and is able to present a Smalltalk like class browser:

enter image description here

Erik
  • 4,268
  • 5
  • 33
  • 49
  • It could be done from a pure metaprograming perspective if you combined it with ri or RDoc. But I don't think anyones actually gone to the work to make a Tk GUI for it or anything. – Linuxios Oct 17 '12 at 13:48
  • ri/RDoc is statically generated, I am talking about live objects like in pry/irb. A Tk GUI would be backwards, Qt might be better in this case (or perhaps web-based, served from a local ruby http daemon) – Erik Oct 17 '12 at 13:52
  • texasbruce> that was my understanding of it, or is ri/RDoc able to generate data from runtime? – Erik Oct 17 '12 at 14:19
  • 1
    What is the difference between running RDoc runtime and running it on the files that have the relevant definitions? – sawa Oct 17 '12 at 15:11
  • That's not what I mean. What I ment was you use standard Ruby meta-programing and then use ri to get the human written documentation for the class in question. – Linuxios Oct 17 '12 at 21:30
  • 1
    @linuxios `ri` requires that documentation is pre-generated. Pry, by contrast, is able to extract documentation at runtime without requiring it to be pregenerated. In fact if you change the source/docs for a method at runtime, pry is able to show the new source/docs. – horseyguy Oct 18 '12 at 05:25
  • @banister: I know. The point is, of you use that to get the human part of the documentation, but extract the other pars at runtimeq, I think you'd have what's wanted. – Linuxios Oct 18 '12 at 13:15
  • @Linuxios I don't understand. Pry can extract exactly the same documentation that `ri` would generate -- the comments above the method. How is `ri` even required here? – horseyguy Oct 19 '12 at 01:00
  • @banister: Nevermind. You're right – Linuxios Oct 19 '12 at 01:12
  • Also have a look here: [Stackoverflow: Browsing Ruby code a la Smalltalk?](http://stackoverflow.com/questions/11894374/browsing-ruby-code-a-la-smalltalk) – Helene Bilbo Oct 19 '12 at 11:16

5 Answers5

7

Check out the maglev/webtools project on github, as well as the rubymirrors gem. It already provides a class browser and workspace for multiple Ruby implementations, and a graphical debugger works on MagLev as well (not so much on MRI).

Tobias
  • 3,026
  • 20
  • 34
3

If you want to build one, the easiest would be to use MOOSE and build the browser with Glamour, on top of a Ruby parser written in PetitParser. Then you could use Pharo as your Ruby IDE.

Stephan Eggermont
  • 15,847
  • 1
  • 38
  • 65
2

You can have a look at the Maglev Database Explorer [1, 2] as well.

[1] Video: http://www.youtube.com/watch?v=27mS1BNP7wQ

[2] Gem: https://github.com/matthias-springer/maglev-database-explorer-gem

knub
  • 3,892
  • 8
  • 38
  • 63
1

There is. It is called Reflexive. https://github.com/dolzenko/reflexive

(I've never taken the time to try it though, so I am curious about other experiences with it.)

trans
  • 1,411
  • 1
  • 13
  • 13
  • Thanks for the suggestion. This is what it looks like on my machine while browsing a Sinatra module: http://i.imgur.com/01OMy.png The techniques it uses might be interesting, but it does not look nor behave like a Smalltalk style class browser. – Erik Oct 22 '12 at 18:21
0

I have no experience with it (and it is old), but may be rbbr still works.

steenslag
  • 79,051
  • 16
  • 138
  • 171