-
Notifications
You must be signed in to change notification settings - Fork 79
improve Kredis::Types::List #151
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
base: main
Are you sure you want to change the base?
Conversation
allow to pass range to List#elements. fix List#last to return typed.
any chance someone can review it? |
lib/kredis/types/list.rb
Outdated
|
||
attr_accessor :typed | ||
|
||
def elements | ||
strings_to_types(lrange(0, -1) || [], typed) | ||
def elements(start = 0, stop = -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than give slicing arguments to #elements
, would introduce #slice
and have #elements
call it.
@list.append [ 1.day.from_now.midnight.in_time_zone("Pacific Time (US & Canada)"), 2.days.from_now.midnight.in_time_zone("UTC") ] | ||
assert_equal [ 1.day.from_now.midnight, 2.days.from_now.midnight ], @list.elements | ||
test "size" do | ||
@list.clear |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would assert_equal 0, @list.size
here rather than having a separate test for size after removal.
remove extra #clear test.
Several
List
improvements.