Skip to content

Commit

Permalink
Add some documentation to Alphabet.
Browse files Browse the repository at this point in the history
  • Loading branch information
wyhaines committed Feb 10, 2023
1 parent 761b455 commit 00c7cb6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/base58/alphabet.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ module Base58
# This is the base class for Base58 Alphabet implementations. It is not intended to be used directly.
class Alphabet
macro inherited
# Query the base58 alphabet for the digit/character that represents the given value.
@[AlwaysInline]
def self.[](val)
BaseToUInt[val]
end

# Query the base58 alphabet for the digit/character that represents the given value. Returns nil if the value is not in the alphabet.
@[AlwaysInline]
def self.[]?(val)
BaseToUInt[val]?
end

# Query the base58 alphabet for the value that the given digit/character represents.
@[AlwaysInline]
def self.inverse(val)
UIntToBase[val]
end

# Query the base58 alphabet for the value that the given digit/character represents. Returns nil if the digit/character is not in the alphabet.
@[AlwaysInline]
def self.inverse?(val)
byte = UIntToBase[val]?
Expand Down

0 comments on commit 00c7cb6

Please sign in to comment.