Reputation: 11
There is an "accept" example in the documentation. But i can't figure out what is the use of the "reject" method? Can somebody explain the sense and give some usage example?
I tried to read the source but no luck.
Upvotes: 1
Views: 63
Reputation: 198476
It simply undoes accept
.
For example, using the snippet in documentation demonstrating accept
:
op.accept(User) do |user_id|
find_user user_id.to_i
end
If after that we issue op.reject(User)
, User
will no longer be accepted — as if op.accept(User) ...
was never specified. If we try, the code would generate unsupported argument type: User (ArgumentError)
.
Upvotes: 0