News for hackers. Stuff that matters.
Re:Show HN: Shale – a Ruby object mapper and serializer for ... by vidarh on Tuesday May 31, 2022 @01:48PM (#31572558)
An added advantage of this approach is that it allows clean integration w/any other mapper or library. E.g. you could define a mapping to your Sequel or ActiveRecord models, and in one go you have the ability to roundtrip between JSON/XML etc. and the ORM.

To the point of rewriting: A halfway point is to drop inheritance in favour of include/extend'ing the models. If that's done cautiously, it allows for co-existing with model objects from libraries that require inheritance. That is, this:

   class Person
     include Shale::Mapper
   end
is preferable to

  class Person < Shale::Mapper
  end

There are no comments on this comment yet.