-
Notifications
You must be signed in to change notification settings - Fork 967
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
Feature Proposal: Humanize ByteSize to rate ("1 KB/s") #296
Comments
Thanks @GeorgeHahn. I don't know. I don't feel it adds much to be honest with you. Humanizer is just a collection of extension methods which means you can very easily extend it yourself. For example you could create a What do others think? |
Might be useful to have something like |
👍 for @justin-edwards |
Sorry @justin-edwards & @hazzik. I don't quite get the API. Why do we pass the timespan in and what's the expected result? Can you provide a complete example? I mean we're calling |
👍 for @justin-edwards @MehdiK The use case would be like this: About other time units, /m /h /d /w, they can be useful for displaying statistical averages, but I don't know how often it's needed. If we decide to go with only /s option, I would drop the extra call to Just my 2c |
Cool. I really like it. I agree with @mexx about removing the extra method call. |
Maybe |
Just implemented this. @justin-edwards, I tried with
|
Sorry, ignore the first commit - I forgot |
@GeorgeHahn cool you tackle it. What do you think about |
I'm worried about situations where that could be confusing: Perhaps That enables this: |
There are two intervals involved, one of the measurement (any interval) and one for display (most likely a fixed unit of time). With the second thought I would stick to
And with an optional parameter
I think it only reads non-obvious when you write it without extra |
I am torn on this tbh; but I like @mexx's suggestion a bit better. We could also provide both methods on |
I agree! Having both intervals makes a lot of sense; I'm not psyched about the codefeel/readability, but I think it will work out! |
Implemented. Here's how it looks:
-> 10 MB/min
I've only implemented H/M/S TimeUnits for now. |
Cool. Please push your changes up to the PR and fix the issues @mexx raised. Also leave us a comment on the PR when that's done as we don't get notifications on commits. Thanks. |
Changes pushed, readme and changelog updated, doco written. Wasn't able to check for R# warnings (uninstalled for C#6 compatibility). Let me know what you think. |
@mexx, did I ever thank you for finishing this up? I tried running the ApiApprover test on my desktop and my laptop; neither worked, even after a fresh install of Win 8.1 on my desktop. I had pretty well abandoned hope for getting this in, so I really appreciate you taking care of it. Thanks! |
Sorry to hear it hurt! You should've let us know so we could help you with We need to find and fix the issue for your future contributions, and also On Tue, Aug 12, 2014 at 9:25 AM, George Hahn [email protected]
|
I can get you stacktraces and open an issue. Is there an ApiApprover On Mon, Aug 11, 2014 at 7:27 PM, Mehdi Khalili [email protected]
|
There is ApiApprover https://github.com/JakeGinnivan/ApiApprover but I'd Thanks a lot. On Tue, Aug 12, 2014 at 9:36 AM, George Hahn [email protected]
|
Proposed API:
1.Megabytes().PerSecond().Humanize(); // 1 MB/s
Questions:
Is this feature desirable?
Are intervals other than one second desirable? (If so, what are some example use cases?)
Off the top of my head, the implementation could be a
PerSecond
extension method forByteSize
that would return aByteSizeRate
class. This would hold aByteSize
and Humanize by appending "/s" to the HumanizedByteSize
.The text was updated successfully, but these errors were encountered: