Class: CryptoAddressValidator::Altcoin
- Inherits:
-
Object
- Object
- CryptoAddressValidator::Altcoin
- Defined in:
- lib/crypto_address_validator/altcoin.rb
Overview
simple class for common altcoin addresses like legacy btc, ripple, dash, zec, etc.
Constant Summary collapse
- EXPECTED_LENGTH =
50
- ADDRESS_TYPES =
{}.freeze
- ALPHABET_TYPE =
:bitcoin
Instance Attribute Summary collapse
-
#address ⇒ Object
(also: #raw_address)
readonly
Returns the value of attribute address.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(address) ⇒ Altcoin
constructor
A new instance of Altcoin.
- #valid?(validated_type = nil) ⇒ Boolean
Constructor Details
#initialize(address) ⇒ Altcoin
Returns a new instance of Altcoin.
13 14 15 16 |
# File 'lib/crypto_address_validator/altcoin.rb', line 13 def initialize(address) @address = address @type = address_type end |
Instance Attribute Details
#address ⇒ Object (readonly) Also known as: raw_address
Returns the value of attribute address.
10 11 12 |
# File 'lib/crypto_address_validator/altcoin.rb', line 10 def address @address end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/crypto_address_validator/altcoin.rb', line 10 def type @type end |
Instance Method Details
#valid?(validated_type = nil) ⇒ Boolean
18 19 20 21 22 23 24 |
# File 'lib/crypto_address_validator/altcoin.rb', line 18 def valid?(validated_type = nil) if validated_type type == validated_type.to_sym else !type.nil? end end |