Class: Nem::Model::ExpelorerBlock

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

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Nem::Mixin::Assignable

#initialize

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



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

def block
  @block
end

#difficultyObject (readonly)

Returns the value of attribute difficulty.



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

def difficulty
  @difficulty
end

#hashObject (readonly)

Returns the value of attribute hash.



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

def hash
  @hash
end

#txesObject (readonly)

Returns the value of attribute txes.



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

def txes
  @txes
end

Class Method Details

.new_from_explorer_block(hash) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/nem/model/explorer_block.rb', line 8

def self.new_from_explorer_block(hash)
  txes = hash[:txes].map do |tx|
    Transaction.(
      meta: { hash: { data: tx[:hash] } },
      transaction: tx[:tx]
    )
  end
  new(
    difficulty: hash[:difficulty],
    txes: txes,
    block: Block.new_from_block(hash[:block]),
    hash: hash[:hash]
  )
end