Class: Aerospike::Node::Generation
- Inherits:
-
Object
- Object
- Aerospike::Node::Generation
- Defined in:
- lib/aerospike/node/generation.rb
Overview
generic class for representing changes in eg. peer and partition generation
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #changed? ⇒ Boolean
- #eql?(number) ⇒ Boolean
-
#initialize(number = -1)) ⇒ Generation
constructor
A new instance of Generation.
- #reset_changed! ⇒ Object
- #update(new_number) ⇒ Object
Constructor Details
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
24 25 26 |
# File 'lib/aerospike/node/generation.rb', line 24 def number @number end |
Instance Method Details
#changed? ⇒ Boolean
31 32 33 |
# File 'lib/aerospike/node/generation.rb', line 31 def changed? @changed.value == true end |
#eql?(number) ⇒ Boolean
35 36 37 |
# File 'lib/aerospike/node/generation.rb', line 35 def eql?(number) @number.value == number end |
#reset_changed! ⇒ Object
39 40 41 |
# File 'lib/aerospike/node/generation.rb', line 39 def reset_changed! @changed.value = false end |
#update(new_number) ⇒ Object
43 44 45 46 47 |
# File 'lib/aerospike/node/generation.rb', line 43 def update(new_number) return if @number.value == new_number @number.value = new_number @changed.value = true end |