Class: Bitcoin::Builder::ScriptBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/bitcoin/builder.rb

Overview

create a Bitcoin::Script used by TxOutBuilder#script.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScriptBuilder

Returns a new instance of ScriptBuilder.



252
253
254
255
# File 'lib/bitcoin/builder.rb', line 252

def initialize
  @type = :address
  @script = nil
end

Instance Attribute Details

#scriptObject (readonly)

Returns the value of attribute script.



250
251
252
# File 'lib/bitcoin/builder.rb', line 250

def script
  @script
end

Instance Method Details

#recipient(*data) ⇒ Object

recipient(s) of the script. depending on the #type, either an address, hash160 pubkey, etc.



264
265
266
# File 'lib/bitcoin/builder.rb', line 264

def recipient *data
  @script = Script.send("to_#{@type}_script", *data)
end

#type(type) ⇒ Object

script type (:pubkey, :address/hash160, :multisig).



258
259
260
# File 'lib/bitcoin/builder.rb', line 258

def type type
  @type = type.to_sym
end