Class: Bitcoin::Builder::ScriptBuilder
- Inherits:
-
Object
- Object
- Bitcoin::Builder::ScriptBuilder
- Defined in:
- lib/bitcoin/builder.rb
Overview
Create a Bitcoin::Script used by TxOutBuilder#script.
Instance Attribute Summary collapse
-
#redeem_script ⇒ Object
readonly
Returns the value of attribute redeem_script.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
Instance Method Summary collapse
-
#initialize ⇒ ScriptBuilder
constructor
A new instance of ScriptBuilder.
-
#recipient(*data) ⇒ Object
Recipient(s) of the script.
-
#type(type) ⇒ Object
Script type (:pubkey, :address/hash160, :multisig).
Constructor Details
#initialize ⇒ ScriptBuilder
Returns a new instance of ScriptBuilder.
435 436 437 438 |
# File 'lib/bitcoin/builder.rb', line 435 def initialize @type = :address @script = nil end |
Instance Attribute Details
#redeem_script ⇒ Object (readonly)
Returns the value of attribute redeem_script.
433 434 435 |
# File 'lib/bitcoin/builder.rb', line 433 def redeem_script @redeem_script end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
433 434 435 |
# File 'lib/bitcoin/builder.rb', line 433 def script @script end |
Instance Method Details
#recipient(*data) ⇒ Object
Recipient(s) of the script. Depending on the #type, this should be an address, a hash160 pubkey, or an array of multisig pubkeys.
449 450 451 |
# File 'lib/bitcoin/builder.rb', line 449 def recipient *data @script, @redeem_script = *Script.send("to_#{@type}_script", *data) end |
#type(type) ⇒ Object
Script type (:pubkey, :address/hash160, :multisig). Defaults to :address.
442 443 444 |
# File 'lib/bitcoin/builder.rb', line 442 def type type @type = type.to_sym end |