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
-
#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.
252 253 254 255 |
# File 'lib/bitcoin/builder.rb', line 252 def initialize @type = :address @script = nil end |
Instance Attribute Details
#script ⇒ Object (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 |