From: sawadatsuyoshi@... Date: 2014-10-26T00:55:22+00:00 Subject: [ruby-core:65900] [ruby-trunk - Feature #10426] [Open] A predicate to express congruence Issue #10426 has been reported by Tsuyoshi Sawada. ---------------------------------------- Feature #10426: A predicate to express congruence https://bugs.ruby-lang.org/issues/10426 * Author: Tsuyoshi Sawada * Status: Open * Priority: Normal * Assignee: * Category: * Target version: ---------------------------------------- I occasionally felt the necessity of a predicate that checks congruence with respect to some operations: ~~~ruby class Object def equal_by? other, &pr pr.call(self) == pr.call(other) end alias congruent? equal_by? end 5.congruent?(2){|e| e % 3} #=> true "HELLO".equal_by?("Hello", &:downcase) #=> true ~~~ -- https://bugs.ruby-lang.org/