rake ルートの配列があり、route.conditions[:request_method] を GET として持つすべてのルートを抽出しようとしています。
問題:
:request_method is a regex (:request_method=>/^GET$/)
> routes.select { |route| route.conditions[:request_method] == /GET/ }
> []
私の選択は正しいと思いました。これは機能し、すべてのルート メソッドを出力します。
> routes.each { |route| print route.conditions[:request_method] }
> {:request_method=>/^GET$/}{:request_method=>/^GET$/}{:request_method=>/^PUT$/}{:request_method=>/^GET$/}{:request_method=>/^PUT$/}{:request_method=>/^POST$/}{:request_method=>/^GET$/}{:request_method=>/^GET$/}
これを達成する方法はありますか?