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
-
#count ⇒ Object
Returns the value of attribute count.
-
#index ⇒ Object
Returns the value of attribute index.
-
#owner ⇒ Object
Returns the value of attribute owner.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count
3 4 5 |
# File 'lib/osctld/id_range/allocation_table.rb', line 3 def count @count end |
#index ⇒ Object
Returns the value of attribute index
3 4 5 |
# File 'lib/osctld/id_range/allocation_table.rb', line 3 def index @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 |
# File 'lib/osctld/id_range/allocation_table.rb', line 4 def self.load(data) new(data['index'], data['count'], data['owner']) end |
Instance Method Details
#dump ⇒ Object
12 13 14 |
# File 'lib/osctld/id_range/allocation_table.rb', line 12 def dump Hash[to_h.map { |k,v| [k.to_s, v] }] end |
#export ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/osctld/id_range/allocation_table.rb', line 16 def export { block_index: index, block_count: count, owner: owner, } end |
#last_index ⇒ Object
8 9 10 |
# File 'lib/osctld/id_range/allocation_table.rb', line 8 def last_index index + count - 1 end |