os6sense / xumlidot

RUBY UML class diagram generator with XMI and DOT output.
MIT License
40 stars 7 forks source link

xumlidot doesn't work right with Ruby 3 #36

Closed ned-pcs closed 2 years ago

ned-pcs commented 3 years ago

... because the sexp_processor is broken in ruby 3.

I've made a PR.

ned-pcs commented 3 years ago

Actually, I got a response to the PR from Justin Collins:

This is a problem in xumlidot.

Sexp inherits from Array. Previously, some Array methods would return the subclass. E.g. Sexp#slice would return an instead of Sexp. In Ruby 3.0, this was standardized so all inherited Array methods that return a new Array return an Array instead of the subclass: https://docs.ruby-lang.org/en/3.0.0/NEWS_md.html#label-Core+classes+updates

I've found Sexp#sexp_body can replace most uses of Sexp#slice or Sexp#[...]: https://github.com/seattlerb/sexp_processor/blob/6b7dbc3424ead7c6be572443d8e0cd430ebce500/lib/sexp.rb#L291-L293

os6sense commented 3 years ago

I've not had the opportunity to look at Ruby 3.0 since I've not had a substantial project to work against - thanks for the heads up.