Class: OsCtld::IdRange::AllocationTable::Allocation
- Inherits:
-
Struct
- Object
- Struct
- OsCtld::IdRange::AllocationTable::Allocation
- Defined in:
- lib/osctld/id_range/allocation_table.rb
Instance Attribute Summary collapse
-
#block_count ⇒ Object
Returns the value of attribute block_count.
-
#block_index ⇒ Object
Returns the value of attribute block_index.
-
#owner ⇒ Object
Returns the value of attribute owner.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#block_count ⇒ Object
Returns the value of attribute block_count
3 4 5 |
# File 'lib/osctld/id_range/allocation_table.rb', line 3 def block_count @block_count end |
#block_index ⇒ Object
Returns the value of attribute block_index
3 4 5 |
# File 'lib/osctld/id_range/allocation_table.rb', line 3 def block_index @block_index end |
#owner ⇒ Object
Returns the value of attribute owner
3 4 5 |
# File 'lib/osctld/id_range/allocation_table.rb', line 3 def owner @owner end |
Class Method Details
.load(data) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/osctld/id_range/allocation_table.rb', line 4 def self.load(data) new( data.fetch('block_index', data['index']), data.fetch('block_count', data['count']), data['owner'] ) end |
Instance Method Details
#dump ⇒ Object
16 17 18 |
# File 'lib/osctld/id_range/allocation_table.rb', line 16 def dump to_h.transform_keys(&:to_s) end |
#export ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/osctld/id_range/allocation_table.rb', line 20 def export { block_index:, block_count:, owner: } end |
#last_index ⇒ Object
12 13 14 |
# File 'lib/osctld/id_range/allocation_table.rb', line 12 def last_index block_index + block_count - 1 end |