Relative units
waiting-for-dev opened this issue · comments
Sometimes to convert a unit to another one you need a third value. What I have in mind is CSS units. For example, if you want to convert inch
to em
you need to provide the relevant font size. I don't have any other use case in mind, but surely there are.
Do you have in mind to allow relative units in alchemist? I have taken a quick look at how your library works, and maybe for relative units something like that could be implemented:
Alchemist.register :distance, [:em] do |value, relevant_font_size|
value/relevant_font_size
end
3.inches.to.em.relative_to(12.inch)
What do you think about it? Would you accept a pull request with it? (I'm not sure I would do it, I'm looking at others gems, too, and I haven't decided yet which one to use)
Thanks a lot. This gems seems really easy to use.
I would be willing to add in the functionality to do what you want. I'm not sure about the syntax though. I want to give it some thought.
I saw you opened a branch. I'm not sure how I'd go about doing this. Since this isn't a "solvable" issue. I'm going to close this, but I'm still open for discussion and would be happy to reopen once a syntax was nailed down.
Yeah, but right now I'm not having the time. If I take it again I'll tell you and discuss about the syntax. Thanks a lot.