Created
March 13, 2013 15:49
-
-
Save jcasimir/5153432 to your computer and use it in GitHub Desktop.
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
class NilClass | |
def join | |
"" | |
end | |
end | |
class Chunks | |
attr_reader :value | |
def initialize(value) | |
@value = value | |
end | |
def split | |
digits = value.to_s | |
backwards = digits.reverse.split("") | |
[ | |
backwards[9..11].join.reverse.to_i, | |
backwards[6..8].join.reverse.to_i, | |
backwards[3..5].join.reverse.to_i, | |
backwards[0..2].join.reverse.to_i, | |
] | |
end | |
# def split | |
# places = [] | |
# places[0] = value / 1_000_000_000 | |
# places[1] = (value % 1_000_000_000) / 1_000_000 | |
# places[2] = (value % 1_000_000) / 1000 | |
# places[3] = value % 1000 | |
# return places | |
# end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment