Class: Bitcoin::Descriptor::KeyExpression

Inherits:
Expression
  • Object
show all
Defined in:
lib/bitcoin/descriptor/key_expression.rb

Direct Known Subclasses

Combo, Pk, Pkh, RawTr, Wpkh

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Expression

#==, #compressed_key?, #derive_path, #extract_pubkey, #to_hex, #to_s, #to_script, #type

Constructor Details

#initialize(key) ⇒ KeyExpression

Constructor

Raises:

  • (ArgumentError)

    If key is invalid.



8
9
10
11
12
# File 'lib/bitcoin/descriptor/key_expression.rb', line 8

def initialize(key)
  raise ArgumentError, "Key must be string." unless key.is_a? String
  extract_pubkey(key)
  @key = key
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



4
5
6
# File 'lib/bitcoin/descriptor/key_expression.rb', line 4

def key
  @key
end

Instance Method Details

#argsObject



14
15
16
# File 'lib/bitcoin/descriptor/key_expression.rb', line 14

def args
  key
end

#extracted_keyBitcoin::Key

Get extracted key.

Returns:



24
25
26
# File 'lib/bitcoin/descriptor/key_expression.rb', line 24

def extracted_key
  extract_pubkey(key)
end

#top_level?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/bitcoin/descriptor/key_expression.rb', line 18

def top_level?
  false
end