-
Notifications
You must be signed in to change notification settings - Fork 150
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
Remove Counter#decrement #17
Conversation
@@ -11,14 +11,12 @@ def type | |||
end | |||
|
|||
def increment(labels = {}, by = 1) | |||
fail ArgumentError, 'increment must be a postive integer' if by < 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.
It must be non-negative, 0 and 0.5 are both fine.
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.
Hm. Right, actually it's about floats (damn untyped languaged). I don't see too much sense in increasing by 0, but fair enough given it's the same as not increasing at all.
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.
Fixed.
f8b0e1b
to
ed9adc7
Compare
@@ -31,6 +31,12 @@ | |||
end.to change { counter.get }.by(5) | |||
end | |||
|
|||
it 'raises an ArgumentError on non-positive increments' do |
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.
non-negative
👍 There's the odd use case, but it's more for consistency with Summary/Histogram. |
It was decided that counters should always be monotonically increasing, so we have to remove possibilities to decrement a counter. Fixes #16.
ed9adc7
to
91f0202
Compare
It was decided that counters should always be monotonically increasing,
so we have to remove possibilities to decrement a counter.
Fixes #16.
@jc @juliusv