These are chat archives for dry-rb/chat

May 2018
May 11 2018 13:27

is there a good ruby gem for transforming hash structures in a declarive, functional way. eg, consider this code I just wrote:

    feed =
      title: feed.title,
      author: feed.itunes_author,
      article_link: feed.url,
      mp3_link: feed.enclosure_url

This is no big deal, because I’m just changing names in a flat hash, but you can imagine more complex cases where you are changing the actual structure (input is deeply nested, output is flat or nested in a different way, etc). what you want to do in these cases is simply specify a mapping from the input name paths to the output name paths using a dot syntax or similar. most functional langs make this kind of thing easy to do but i’d like to do the same in ruby.

Nikita Shilnikov
May 11 2018 13:28
@jonahx we do have one
May 11 2018 13:30
@flash-gordon exactly! thank you. i knew dry-rb would have this solved :)