Class: Nem::Model::Block

Inherits:
Object
  • Object
show all
Includes:
Nem::Mixin::Assignable
Defined in:
lib/nem/model/block.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Nem::Mixin::Assignable

#initialize

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



6
7
8
# File 'lib/nem/model/block.rb', line 6

def height
  @height
end

#prev_block_hashObject (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

#signatureObject (readonly)

Returns the value of attribute signature.



6
7
8
# File 'lib/nem/model/block.rb', line 6

def signature
  @signature
end

#signerObject (readonly)

Returns the value of attribute signer.



6
7
8
# File 'lib/nem/model/block.rb', line 6

def signer
  @signer
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



6
7
8
# File 'lib/nem/model/block.rb', line 6

def timestamp
  @timestamp
end

#transactionsObject (readonly)

Returns the value of attribute transactions.



6
7
8
# File 'lib/nem/model/block.rb', line 6

def transactions
  @transactions
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/nem/model/block.rb', line 6

def type
  @type
end

#versionObject (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.(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