-
Notifications
You must be signed in to change notification settings - Fork 23
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 counter:reset method #288
Conversation
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.
PR's missing changelog and doc edits
@@ -9,4 +9,8 @@ function Counter:inc(num, label_pairs) | |||
Shared.inc(self, num, label_pairs) | |||
end | |||
|
|||
function Counter:reset(label_pairs) |
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.
The original request was about counter initialization. Initialization with counter:reset(label_pairs)
seems kinda weird. How about adding an alias for reset
as a little syntactic sugar?
Counter.initialize = reset
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.
init / reinit / reset, who cares. Reset is better than inc(0), and that's the purpose.
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.
Init which resets the value may be considered weird too.
85ddf9d
to
762ef62
Compare
762ef62
to
cbe4a3e
Compare
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.
Well, I'm still prefer having both init
and reset
, but if you're against it, let's at least add the functionality
I didn't forget about
Close #260