Class: Nem::Model::Block
- Inherits:
-
Object
- Object
- Nem::Model::Block
- Includes:
- Nem::Mixin::Assignable
- Defined in:
- lib/nem/model/block.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#prev_block_hash ⇒ Object
readonly
Returns the value of attribute prev_block_hash.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
-
#signer ⇒ Object
readonly
Returns the value of attribute signer.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#transactions ⇒ Object
readonly
Returns the value of attribute transactions.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Methods included from Nem::Mixin::Assignable
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
6 7 8 |
# File 'lib/nem/model/block.rb', line 6 def height @height end |
#prev_block_hash ⇒ Object (readonly)
Returns the value of attribute prev_block_hash.
6 7 8 |
# File 'lib/nem/model/block.rb', line 6 def prev_block_hash @prev_block_hash end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
6 7 8 |
# File 'lib/nem/model/block.rb', line 6 def signature @signature end |
#signer ⇒ Object (readonly)
Returns the value of attribute signer.
6 7 8 |
# File 'lib/nem/model/block.rb', line 6 def signer @signer end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/nem/model/block.rb', line 6 def @timestamp end |
#transactions ⇒ Object (readonly)
Returns the value of attribute transactions.
6 7 8 |
# File 'lib/nem/model/block.rb', line 6 def transactions @transactions end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/nem/model/block.rb', line 6 def type @type end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/nem/model/block.rb', line 6 def version @version end |
Class Method Details
.new_from_block(hash) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nem/model/block.rb', line 15 def self.new_from_block(hash) txes = hash[:transactions].map do |tx| Transaction.new_from_account_transaction(tx) end new( timestamp: hash[:timeStamp], signature: hash[:signature], prev_block_hash: hash[:prevBlockHash][:data], type: hash[:type], transactions: txes, version: hash[:version], signer: hash[:signer], height: hash[:height] ) end |