Created
July 31, 2010 12:34
-
-
Save basti/502133 to your computer and use it in GitHub Desktop.
Convert height/length from cm to feet and inches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.cm_to_feet_and_inches(cm) | |
feet = (cm / 30.48).floor | |
inches_total = cm / 2.54 | |
inches = (inches_total - (feet * 12)).round | |
"#{feet} #{inches}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment