Declare once how fields map from one object to another, and Mappable compiles it into plain Ruby methods that copy the data both ways at close to hand-written speed. Rename fields, combine several into one (first_name + last_name -> name) and split them back out, and skip fields with conditions on the source, the destination or the mapping itself. Works with any objects that have getters and setters: Structs, ActiveRecord models, plain Ruby classes.

Required Ruby Version

>= 3.3

Authors

Doug Youch

Versions

  1. 0.3.0
    1. source

      1. 0.3.0 source October 05, 2026 (13 KB)
  2. 0.2.0
    1. source

      1. 0.2.0 source October 05, 2026 (12.5 KB)
  3. 0.1.0
    1. source

      1. 0.1.0 source September 04, 2019 (8 KB)

Pushed by

GitHub

SHA 256 checksum