Class: RubyCoin::Address
- Inherits:
-
Object
- Object
- RubyCoin::Address
- Includes:
- Utilities
- Defined in:
- lib/ruby_coin/address.rb
Direct Known Subclasses
Bitcoin::Address, Dogecoin::Address, Feathercoin::Address, Litecoin::Address, Megacoin::Address, Namecoin::Address, Peercoin::Address, Primecoin::Address, Quarkcoin::Address, Worldcoin::Address
Instance Attribute Summary collapse
-
#compressed ⇒ Object
Returns the value of attribute compressed.
-
#curve ⇒ Object
Returns the value of attribute curve.
-
#private_key ⇒ Object
(also: #secret)
Returns the value of attribute private_key.
-
#public_key ⇒ Object
Returns the value of attribute public_key.
Instance Method Summary collapse
- #compressed? ⇒ Boolean
-
#initialize(seed, *args) ⇒ Address
constructor
A new instance of Address.
- #to_s ⇒ Object
Methods included from Utilities
Constructor Details
#initialize(seed, *args) ⇒ Address
Returns a new instance of Address.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ruby_coin/address.rb', line 7 def initialize(seed, *args) = (args) case [:format] when :uncompressed @compressed = false else @compressed = true end self.curve = ::OpenSSL::PKey::EC.new(seed, *args) curve.generate_key curve.private_key? ? init_private_key : nil_private_key curve.public_key? ? init_public_key : nil_public_key end |
Instance Attribute Details
#compressed ⇒ Object
Returns the value of attribute compressed.
5 6 7 |
# File 'lib/ruby_coin/address.rb', line 5 def compressed @compressed end |
#curve ⇒ Object
Returns the value of attribute curve.
5 6 7 |
# File 'lib/ruby_coin/address.rb', line 5 def curve @curve end |
#private_key ⇒ Object Also known as: secret
Returns the value of attribute private_key.
5 6 7 |
# File 'lib/ruby_coin/address.rb', line 5 def private_key @private_key end |
#public_key ⇒ Object
Returns the value of attribute public_key.
5 6 7 |
# File 'lib/ruby_coin/address.rb', line 5 def public_key @public_key end |
Instance Method Details
#compressed? ⇒ Boolean
30 31 32 |
# File 'lib/ruby_coin/address.rb', line 30 def compressed? !!@compressed end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/ruby_coin/address.rb', line 26 def to_s address end |