Skip to content
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

adding #round to Vector as well as Matrix #802

Closed
wants to merge 1 commit into from

Conversation

jordanstephens
Copy link

It looks like @marcandre added #round to Matrix some years ago, but I would also like to be able to use this method with instances of Vector.

Because both Matrix and Vector both store their components in an underlying Array, and implement #map over that Array, I propose moving Matrix#round to Matrix::RoundHelper so that it may be included in both the Matrix and Vector classes and the functionality may be shared between them.

@marcandre
Copy link
Member

Thanks for the PR.

Adding Vector#round sounds fine.

The helper isn't a bad idea (although I'm not sure why you defined a round_to instead of round directly), but since the implementation is really so simple, I'm not sure it's really necessary. I think it might be best to keep it duplicated, for example so the documentation works.

@jordanstephens
Copy link
Author

I'm not sure why you defined a round_to instead of round directly

I actually did this to allow the method to be documented properly in each module. But if we think it's okay to have that bit of repeated code, we won't have to worry about that anymore.

I just pushed an amended commit.

Thanks @marcandre!

@jordanstephens
Copy link
Author

@marcandre should I submit this to the ruby issue tracker over at https://bugs.ruby-lang.org ? Is there any hope of this getting merged from here on github?

@marcandre
Copy link
Member

Awesome, thanks for the reminder.

@marcandre marcandre closed this Mar 5, 2015
marcandre added a commit that referenced this pull request Mar 5, 2015
  [Fixes GH-802]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
@jordanstephens
Copy link
Author

Awesome, thanks so much!

mmasaki pushed a commit to mmasaki/ruby that referenced this pull request May 30, 2015
  [Fixes rubyGH-802]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
@eregon eregon mentioned this pull request Dec 16, 2015
51 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants