Class: Base32::Alphabet
- Inherits:
-
Object
- Object
- Base32::Alphabet
- Defined in:
- lib/base32/alphabet.rb
Constant Summary collapse
- CHARS =
'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
Instance Attribute Summary collapse
-
#chars ⇒ Object
(also: #to_s)
Returns the value of attribute chars.
Instance Method Summary collapse
- #chars_valid?(chars) ⇒ Boolean
-
#initialize(chars) ⇒ Alphabet
constructor
A new instance of Alphabet.
- #inspect ⇒ Object
Constructor Details
#initialize(chars) ⇒ Alphabet
Returns a new instance of Alphabet.
11 12 13 |
# File 'lib/base32/alphabet.rb', line 11 def initialize(chars) self.chars = chars end |
Instance Attribute Details
#chars ⇒ Object Also known as: to_s
Returns the value of attribute chars.
7 8 9 |
# File 'lib/base32/alphabet.rb', line 7 def chars @chars end |
Instance Method Details
#chars_valid?(chars) ⇒ Boolean
27 28 29 |
# File 'lib/base32/alphabet.rb', line 27 def chars_valid?(chars) chars.bytes.to_a.size == 32 && chars.bytes.to_a.uniq.size == 32 end |
#inspect ⇒ Object
15 16 17 |
# File 'lib/base32/alphabet.rb', line 15 def inspect "#<#{self.class}:#{chars.inspect}>" end |