Class: Web3::Eth::Block
- Inherits:
-
Object
- Object
- Web3::Eth::Block
- Includes:
- Utility
- Defined in:
- lib/web3ethereum/block.rb
Instance Attribute Summary collapse
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Instance Method Summary collapse
- #block_number ⇒ Object
-
#initialize(block_data) ⇒ Block
constructor
A new instance of Block.
- #timestamp_time ⇒ Object
Methods included from Utility
#from_hex, #hex, #remove_0x_head, #wei_to_ether
Constructor Details
#initialize(block_data) ⇒ Block
Returns a new instance of Block.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/web3ethereum/block.rb', line 10 def initialize block_data @raw_data = block_data block_data.each do |k, v| self.instance_variable_set("@#{k}", v) self.class.send(:define_method, k, proc {self.instance_variable_get("@#{k}")}) end @transactions = @transactions.collect {|t| Web3::Eth::Transaction.new t } end |
Instance Attribute Details
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
8 9 10 |
# File 'lib/web3ethereum/block.rb', line 8 def raw_data @raw_data end |
Instance Method Details
#block_number ⇒ Object
26 27 28 |
# File 'lib/web3ethereum/block.rb', line 26 def block_number from_hex number end |
#timestamp_time ⇒ Object
22 23 24 |
# File 'lib/web3ethereum/block.rb', line 22 def Time.at from_hex end |