Class: Casper::Entity::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/entity/block.rb

Overview

Block

Instance Method Summary collapse

Constructor Details

#initialize(hash, header = {}, body = {}, proofs = []) ⇒ Block

Returns a new instance of Block.

Parameters:

  • hash (String)
  • header (Hash) (defaults to: {})
  • body (Hash) (defaults to: {})
  • proofs (Array<Hash>) (defaults to: [])


10
11
12
13
14
15
16
# File 'lib/entity/block.rb', line 10

def initialize(hash, header = {}, body = {}, proofs = [])
  @hash = hash
  @header = Casper::Entity::BlockHeader.new(header)
  @body = Casper::Entity::BlockBody.new(body)
  @proofs = []
  proofs.each { |proof| @proofs << Casper::Entity::BlockProof.new(proof) }
end

Instance Method Details

#get_body ⇒ BlockBody

Returns block body.

Returns:



29
30
31
# File 'lib/entity/block.rb', line 29

def get_body
  @body
end

#get_hash ⇒ String

Returns block hash.

Returns:

  • (String) —

    block hash



19
20
21
# File 'lib/entity/block.rb', line 19

def get_hash
  @hash
end

#get_header ⇒ BlockHeader

Returns block header.

Returns:



24
25
26
# File 'lib/entity/block.rb', line 24

def get_header
  @header
end

#get_proofs ⇒ Array<BlockProof>

Returns list of proofs for this block.

Returns:

  • (Array<BlockProof>) —

    list of proofs for this block



34
35
36
# File 'lib/entity/block.rb', line 34

def get_proofs
  @proofs
end