Module: Base58
- Defined in:
- lib/base58-alphabets/base.rb,
lib/base58-alphabets/base58.rb,
lib/base58-alphabets/flickr.rb,
lib/base58-alphabets/bitcoin.rb,
lib/base58-alphabets/version.rb
Overview
shared code for formats / variants with single char alphabets
e.g. Bitcoin, Flickr, ...
Defined Under Namespace
Classes: Base, Bitcoin, Configuration, Flickr
Constant Summary
collapse
- MAJOR =
1
- MINOR =
0
- PATCH =
0
- VERSION =
[MAJOR,MINOR,PATCH].join('.')
Class Method Summary
collapse
Class Method Details
.alphabet(klass: configuration.format) ⇒ Object
encoding alphabet - letter-to-number by index / array
56
|
# File 'lib/base58-alphabets/base58.rb', line 56
def self.alphabet( klass: configuration.format ) klass.alphabet; end
|
.banner ⇒ Object
13
14
15
|
# File 'lib/base58-alphabets/version.rb', line 13
def self.banner
"base58-alphabets/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in (#{root})"
end
|
.configuration ⇒ Object
lets you use
Base58.configure do |config|
config.format = :bitcoin
end
30
31
32
|
# File 'lib/base58-alphabets/base58.rb', line 30
def self.configuration
@configuration ||= Configuration.new
end
|
34
35
36
|
# File 'lib/base58-alphabets/base58.rb', line 34
def self.configure
yield( configuration )
end
|
.decode_bin(str, klass: configuration.format) ⇒ Object
50
|
# File 'lib/base58-alphabets/base58.rb', line 50
def self.decode_bin( str, klass: configuration.format ) klass.decode_bin( str ); end
|
.decode_hex(str, klass: configuration.format) ⇒ Object
51
|
# File 'lib/base58-alphabets/base58.rb', line 51
def self.decode_hex( str, klass: configuration.format ) klass.decode_hex( str ); end
|
.decode_num(str, klass: configuration.format) ⇒ Object
49
|
# File 'lib/base58-alphabets/base58.rb', line 49
def self.decode_num( str, klass: configuration.format ) klass.decode_num( str ); end
|
.encode_bin(data, klass: configuration.format) ⇒ Object
46
|
# File 'lib/base58-alphabets/base58.rb', line 46
def self.encode_bin( data, klass: configuration.format ) klass.encode_bin( data ); end
|
.encode_hex(str, klass: configuration.format) ⇒ Object
47
|
# File 'lib/base58-alphabets/base58.rb', line 47
def self.encode_hex( str, klass: configuration.format ) klass.encode_hex( str ); end
|
.encode_num(num, klass: configuration.format) ⇒ Object
45
|
# File 'lib/base58-alphabets/base58.rb', line 45
def self.encode_num( num, klass: configuration.format ) klass.encode_num( num ); end
|
add convenience helper for format
39
|
# File 'lib/base58-alphabets/base58.rb', line 39
def self.format() configuration.format; end
|
40
|
# File 'lib/base58-alphabets/base58.rb', line 40
def self.format=(value) self.configuration.format = value; end
|
.number(klass: configuration.format) ⇒ Object
decoding letter-to-number mapping / hash
59
|
# File 'lib/base58-alphabets/base58.rb', line 59
def self.number( klass: configuration.format ) klass.number; end
|
.root ⇒ Object
17
18
19
|
# File 'lib/base58-alphabets/version.rb', line 17
def self.root
File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
end
|
.version ⇒ Object
9
10
11
|
# File 'lib/base58-alphabets/version.rb', line 9
def self.version
VERSION
end
|