Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add []= and remove to hash callback methods #54

Merged
merged 1 commit into from
Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/kredis/types/callbacks_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Kredis::Types::CallbacksProxy
Kredis::Types::Cycle => %i[ next ],
Kredis::Types::Enum => %i[ value= reset ],
Kredis::Types::Flag => %i[ mark remove ],
Kredis::Types::Hash => %i[ update delete ],
Kredis::Types::Hash => %i[ update delete []= remove ],
Kredis::Types::List => %i[ remove prepend append << ],
Kredis::Types::Scalar => %i[ value= clear ],
Kredis::Types::Set => %i[ add << remove replace take clear ],
Expand Down
5 changes: 5 additions & 0 deletions test/attributes_callbacks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ def id
assert_callback_executed_for :kredis_hash, :proc, ->(type) { type.update space_invaders: 100, pong: 42 }
assert_callback_executed_for :kredis_hash, :method, ->(type) { type.update space_invaders: 100, pong: 42 }

assert_callback_executed_for :kredis_hash, :proc, ->(type) { type[:space_invaders] = 0 }
assert_callback_executed_for :kredis_hash, :method, ->(type) { type[:space_invaders] = 0 }

assert_callback_executed_for :kredis_hash, :proc, ->(type) { type.delete "key" }

assert_callback_executed_for :kredis_hash, :method, ->(type) { type.remove }
end

private
Expand Down