Skip to content

Better handling of Rational values in #to_s #26

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 2 commits into from
Jan 8, 2015

Conversation

fordhurley
Copy link
Collaborator

Added #value_string to parallel #unit_string, which does two things when the value is Rational:

  • If the denominator is 1, don't show it.
  • Otherwise, wrap the value in parentheses so that it can be parsed properly.

Also added specs for two cases that would fail previously.

Should fix #22.

Added #value_string to parallel #unit_string, which does two things when
the value is Rational:

- If the denominator is 1, don't show it.
- Otherwise, wrap the value in parentheses so that it can be parsed
  properly.

Also added specs for two cases that would fail previously.

Should fix minad#22.
@minad
Copy link
Owner

minad commented Jan 7, 2015

Hi, I added you as a collaborator. You can push yourself and just tell we when you think it is ready for a release. Could you also add tests for value_string etc?

@fordhurley
Copy link
Collaborator Author

Great! Specs on value_string was a great idea.

fordhurley added a commit that referenced this pull request Jan 8, 2015
Better handling of Rational values in #to_s
@fordhurley fordhurley merged commit df0fca8 into minad:master Jan 8, 2015
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.

#to_s doesn't round-trip for some values
2 participants