Skip to content

Better handling of Rational values in #to_s#26

Merged
fordhurley merged 2 commits into
minad:masterfrom
fordhurley:fix-rational-to_s
Jan 8, 2015
Merged

Better handling of Rational values in #to_s#26
fordhurley merged 2 commits into
minad:masterfrom
fordhurley:fix-rational-to_s

Conversation

@fordhurley

Copy link
Copy Markdown
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

minad commented Jan 7, 2015

Copy link
Copy Markdown
Owner

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
Copy Markdown
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