Skip to content

Commit

Permalink
Better variable name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Berke-Williams committed Apr 7, 2012
1 parent 0637262 commit afcf384
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 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
Expand Down

0 comments on commit afcf384

Please sign in to comment.