interagent / pliny

An opinionated toolkit for writing excellent APIs in Ruby.
MIT License
802 stars 73 forks source link

Use IndifferentHash class instead of method #317

Closed dmathieu closed 6 years ago

dmathieu commented 6 years ago

The indifferent_params method doesn't exist anymore in Sinatra 2.0 (See https://github.com/sinatra/sinatra/commit/44c3cb89b7c9e26ce66e0e9bfe5a481fbef6fc22#diff-f2bc16b264ca20ca842cf15d82960d34 ).

cc @bigkevmcd

brandur commented 6 years ago

Thanks for the tests! This looks good to me (also, this makes way more sense as a class method so I'm relatively glad to see that Sinatra changed it even if it's annoying).

Do you know if @gudmundur or someone else can run a release? I haven't done one in a while.

gudmundur commented 6 years ago

Thanks @dmathieu. Will this work with Sinatra 1? I know the class exists, but I'm not sure it'll behave the same way.

If this doesn't work with Sinatra 1, we can either:

  1. Add a support method that'll detect whether the method or class should be used. Thus support both versions.
  2. Drop support for Sinatra 1, and cut a major version of Pliny.

My personal preference would be to support both, with a comment about dropping some code in the future once we go Sinatra 2 only.

dmathieu commented 6 years ago

Very good point. I've just added support for both.

gudmundur commented 6 years ago

@dmathieu Nice work. This looks good to me. @brandur does this seem solid to you as well?

brandur commented 6 years ago

Yeah, looks good to me! Thanks @dmathieu, and nice catch on that one @gudmundur.