Class: Base32::Decoder

Inherits:
Object
  • Object
show all
Defined in:
lib/base32/decoder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, alphabet = Base32::Alphabet::CHARS) ⇒ Decoder

Returns a new instance of Decoder.



7
8
9
10
# File 'lib/base32/decoder.rb', line 7

def initialize(str, alphabet = Base32::Alphabet::CHARS)
  @str      = str
  @alphabet = alphabet
end

Instance Attribute Details

#alphabetObject (readonly)

Returns the value of attribute alphabet.



5
6
7
# File 'lib/base32/decoder.rb', line 5

def alphabet
  @alphabet
end

#strObject (readonly)

Returns the value of attribute str.



5
6
7
# File 'lib/base32/decoder.rb', line 5

def str
  @str
end

Instance Method Details

#callObject



12
13
14
# File 'lib/base32/decoder.rb', line 12

def call
  Base32::Chunk.call(str, 8, alphabet).collect(&:decode).flatten.join
end