-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Update documentation for Duration#to_s #20293
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
Conversation
@@ -52,6 +52,13 @@ def ==(other) | |||
end | |||
end | |||
|
|||
# Returns the string with number of seconds that this Duration represents. |
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.
What about "Returns the amount of seconds a duration covers as a string."
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.
looks better, thx! 😃
bb38fe7
to
3291b64
Compare
@kaspth fixed |
@@ -86,7 +93,7 @@ def eql?(other) | |||
Duration === other && other.value.eql?(value) | |||
end | |||
|
|||
def hash | |||
def hash # :nodoc: |
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.
To me this should be left public, so people know a duration can be embedded in a collection. But don't bother documenting it. Let's rely on users knowing Ruby semantics instead.
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.
i don't agree, this method returns hash of object like as Object#hash
2.2.2 :067 > 1.year.hash
=> -68723588783739193
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.
Yes, I know. If we nodoc it will Rdoc then point to the Object#hash documentation?
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.
hmm, i think no. What you think if we say(and remove nodoc) that the method is the same as Object#hash
?
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.
We don't have to say that. People know that already because we're overriding it. It's a standard OO convention to override a superclass method for specialization, so we don't have to tell people that.
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.
okay, I understand, and now I think I need remove nodoc, you agree?
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.
Yes.
3291b64
to
fd04d52
Compare
@kaspth updated |
@@ -52,6 +52,9 @@ def ==(other) | |||
end | |||
end | |||
|
|||
# Returns the amount of seconds a duration covers as a string. | |||
# | |||
# 1.day.to_s # => "86400" |
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.
One space after to_s
here.
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.
Forget this, it matches all the others down the line.
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.
oops 😓
updated
fd04d52
to
4e93299
Compare
@@ -52,6 +52,9 @@ def ==(other) | |||
end | |||
end | |||
|
|||
# Returns the amount of seconds a duration covers as a string. | |||
# | |||
# 1.day.to_s # => "86400" |
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.
Maybe we should link to to_i
here, which has a lot more information.
4e93299
to
bf4d97b
Compare
@kaspth added |
We need to make sure Rdoc creates a link otherwise it's moot. |
Also your commit message is off now. I'm starting to feel like this might not be worth it, given all the back and forth we've been doing on this now 😅 |
bf4d97b
to
ac60731
Compare
@kaspth link will be created, you can see this in screenshot below. Also I updated the commit message 😃 |
Alright, per our documentation guidelines we want to avoid "you"s and "your"s, so if you can find a way to rephrase that we're golden 👍 |
ac60731
to
2c72589
Compare
@kaspth complete this too 😃 |
Update documentation for Duration#to_s
Alright, took a while but it's good now ❤️ |
wow, we did it 🎉 |
No description provided.