Class: Lapidar::Block
- Inherits:
-
Object
- Object
- Lapidar::Block
- Defined in:
- lib/lapidar/block.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#nonce ⇒ Object
readonly
Returns the value of attribute nonce.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(number:, hash:, nonce:, data: nil, created_at: Time.now.to_f) ⇒ Block
constructor
A new instance of Block.
- #to_h ⇒ Object
Constructor Details
#initialize(number:, hash:, nonce:, data: nil, created_at: Time.now.to_f) ⇒ Block
Returns a new instance of Block.
5 6 7 8 9 10 11 |
# File 'lib/lapidar/block.rb', line 5 def initialize(number:, hash:, nonce:, data: nil, created_at: Time.now.to_f) @number = number @hash = hash @nonce = nonce @data = data @created_at = created_at end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/lapidar/block.rb', line 3 def created_at @created_at end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/lapidar/block.rb', line 3 def data @data end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
3 4 5 |
# File 'lib/lapidar/block.rb', line 3 def hash @hash end |
#nonce ⇒ Object (readonly)
Returns the value of attribute nonce.
3 4 5 |
# File 'lib/lapidar/block.rb', line 3 def nonce @nonce end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
3 4 5 |
# File 'lib/lapidar/block.rb', line 3 def number @number end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 |
# File 'lib/lapidar/block.rb', line 23 def ==(other) to_h == other.to_h end |
#to_h ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/lapidar/block.rb', line 13 def to_h { number: @number, hash: @hash, nonce: @nonce, data: @data, created_at: @created_at, } end |