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

Better to_s #40

Open
dkniffin opened this issue Jan 22, 2016 · 1 comment
Open

Better to_s #40

dkniffin opened this issue Jan 22, 2016 · 1 comment

Comments

@dkniffin
Copy link

Right now, alchemist provides very basic to_s methods. In the case of a simple measurement, they simply convert the float version of the measurement to a string:

irb(main):003:0> 1.meter.to_s
=> "1.0"
irb(main):004:0> 3.seconds.to_s
=> "3.0"

In the case of compound measurements, they don't even do that much:

irb(main):005:0> 2.meters.per.second.to_s
=> "#<Alchemist::CompoundMeasurement:0x007ff3c18e9060>"
irb(main):006:0>

It'd be awesome if it printed nice strings for these:

=> 1.meter.to_s
"1 meter"
=> 3.seconds.to_s
"3 seconds"
=> 1.s.to_s
"1 second"
=> 30.miles.per.hour
"30 miles/hour"
@halogenandtoast
Copy link
Owner

This is on my list of todos. Not sure when I'll get to it though.

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

No branches or pull requests

2 participants