From 00c7cb6fb16a124a0cbd86402a0fac0bb8edcee6 Mon Sep 17 00:00:00 2001 From: Kirk Haines Date: Thu, 9 Feb 2023 17:48:36 -0700 Subject: [PATCH] Add some documentation to Alphabet. --- src/base58/alphabet.cr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/base58/alphabet.cr b/src/base58/alphabet.cr index ed24a71..d95b24e 100644 --- a/src/base58/alphabet.cr +++ b/src/base58/alphabet.cr @@ -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]?