Skip to content

Instantly share code, notes, and snippets.

@jcasimir
Created March 13, 2013 15:49
Show Gist options
  • Save jcasimir/5153432 to your computer and use it in GitHub Desktop.
Save jcasimir/5153432 to your computer and use it in GitHub Desktop.
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