Class: Paleth::Block

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

Overview

Represents an ethereum transaction block.

Constant Summary collapse

SIMPLE_METHODS =
i(number hash parent_hash nonce sha3_uncles logs_bloom
transactions_root state_root miner extra_data size
gas_limit gas_used timestamp transactions uncles)
BIGDECIMAL_METHODS =
i(difficulty total_difficulty)

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Block

Returns a new instance of Block.


4
5
6
# File 'lib/paleth/block.rb', line 4

def initialize(data)
  @data = data
end

Instance Method Details

#to_sObject


25
26
27
28
29
30
31
32
# File 'lib/paleth/block.rb', line 25

def to_s
  data = [SIMPLE_METHODS + BIGDECIMAL_METHODS].flatten.map do |name|
    value = self.send(name)
    "#{name}=#{value}"
  end.join(', ')

  "Block(#{data})"
end