Skip to content

Commit

Permalink
Merge pull request #96 from etiennebarrie/add-list-ltrim
Browse files Browse the repository at this point in the history
Add `LTRIM` to lists
  • Loading branch information
rafaelfranca committed Sep 1, 2022
2 parents 48ffc65 + b11d445 commit f7645ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kredis/types/list.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Kredis::Types::List < Kredis::Types::Proxying
proxying :lrange, :lrem, :lpush, :rpush, :exists?, :del
proxying :lrange, :lrem, :lpush, :ltrim, :rpush, :exists?, :del

attr_accessor :typed

Expand Down
6 changes: 6 additions & 0 deletions test/types/list_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,10 @@ class ListTest < ActiveSupport::TestCase
@list.append(%w[ 1 2 3 ])
assert @list.exists?
end

test "ltrim" do
@list.append(%w[ 1 2 3 4 ])
@list.ltrim(-3, -2)
assert_equal %w[ 2 3 ], @list.elements
end
end

0 comments on commit f7645ee

Please sign in to comment.