From afcf3849a86caebe9955d275f1356425e1327957 Mon Sep 17 00:00:00 2001 From: Gabe Berke-Williams Date: Sat, 7 Apr 2012 17:00:29 -0400 Subject: [PATCH] Better variable name. --- lib/decoder.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/decoder.rb b/lib/decoder.rb index e02c2e8..9aa82a8 100644 --- a/lib/decoder.rb +++ b/lib/decoder.rb @@ -1,12 +1,12 @@ # http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener class Decoder - def initialize(id) - @id = id + def initialize(hash) + @hash = hash end def decode sum = 0 - @id.split('').map do |chunk| + @hash.split('').map do |chunk| Encoder::CHARS.index(chunk) end.reverse.each_with_index do |chunk, i| sum += chunk * Encoder::BASE ** i