Skip to content

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

Merged
merged 1 commit into from
May 25, 2015
Merged

Conversation

davydovanton
Copy link
Contributor

No description provided.

@@ -52,6 +52,13 @@ def ==(other)
end
end

# Returns the string with number of seconds that this Duration represents.
Copy link
Contributor

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."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks better, thx! 😃

@davydovanton
Copy link
Contributor Author

@kaspth fixed

@@ -86,7 +93,7 @@ def eql?(other)
Duration === other && other.value.eql?(value)
end

def hash
def hash # :nodoc:
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@davydovanton davydovanton changed the title Update documentation for Duration #to_s and #hash Update documentation for Duration#to_s May 25, 2015
@davydovanton
Copy link
Contributor Author

@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"
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops 😓
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"
Copy link
Contributor

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.

@davydovanton
Copy link
Contributor Author

@kaspth added #to_i to #to_s documentation

@kaspth
Copy link
Contributor

kaspth commented May 25, 2015

We need to make sure Rdoc creates a link otherwise it's moot.

@kaspth
Copy link
Contributor

kaspth commented May 25, 2015

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 😅

@davydovanton
Copy link
Contributor Author

@kaspth link will be created, you can see this in screenshot below. Also I updated the commit message 😃
screenshot 2015-05-25 15 59 33

@kaspth
Copy link
Contributor

kaspth commented May 25, 2015

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 👍

@davydovanton
Copy link
Contributor Author

@kaspth complete this too 😃

kaspth added a commit that referenced this pull request May 25, 2015
Update documentation for Duration#to_s
@kaspth kaspth merged commit 7a08b2c into rails:master May 25, 2015
@kaspth
Copy link
Contributor

kaspth commented May 25, 2015

Alright, took a while but it's good now ❤️

@davydovanton
Copy link
Contributor Author

wow, we did it 🎉
thanks for review 💚

@davydovanton davydovanton deleted the doc-duration branch May 25, 2015 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants