Class: Bitcoin::Descriptor::Raw

Inherits:
Expression show all
Defined in:
lib/bitcoin/descriptor/raw.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Expression

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

Constructor Details

#initialize(hex) ⇒ Raw

Constructor

Parameters:

Raises:

  • (ArgumentError)


9
10
11
12
13
# File 'lib/bitcoin/descriptor/raw.rb', line 9

def initialize(hex)
  raise ArgumentError, "Raw script must be string." unless hex.is_a?(String)
  raise ArgumentError, "Raw script is not hex." unless hex.valid_hex?
  @hex = hex
end

Instance Attribute Details

#hexObject (readonly)

Returns the value of attribute hex.



5
6
7
# File 'lib/bitcoin/descriptor/raw.rb', line 5

def hex
  @hex
end

Instance Method Details

#argsObject



23
24
25
# File 'lib/bitcoin/descriptor/raw.rb', line 23

def args
  hex
end

#to_scriptObject



19
20
21
# File 'lib/bitcoin/descriptor/raw.rb', line 19

def to_script
  Bitcoin::Script.parse_from_payload(hex.htb)
end

#top_level?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/bitcoin/descriptor/raw.rb', line 27

def top_level?
  true
end

#typeObject



15
16
17
# File 'lib/bitcoin/descriptor/raw.rb', line 15

def type
  :raw
end