lib/ffi-icu/collation.rb in ffi-icu-0.0.1 vs lib/ffi-icu/collation.rb in ffi-icu-0.0.2

- old
+ new

@@ -57,11 +57,18 @@ def greater_or_equal?(a, b) Lib.ucol_greaterOrEqual(@c, UCharPointer.from_string(a), a.length, UCharPointer.from_string(b), b.length) end - # can't override Object#equal? - suggestions welcome - def same?(a, b) + def equal?(*args) + return super() if args.empty? + + if args.size != 2 + raise ArgumentError, "wrong number of arguments (#{args.size} for 2)" + end + + a, b = args + Lib.ucol_equal(@c, UCharPointer.from_string(a), a.length, UCharPointer.from_string(b), b.length) end def collate(array)