Class: PgVerify::Model::AllocationSet
- Inherits:
-
Object
- Object
- PgVerify::Model::AllocationSet
- Defined in:
- lib/pg-verify/model/allocation_set.rb
Instance Attribute Summary collapse
-
#allocations ⇒ Object
An array of allocations for those variables.
-
#variables ⇒ Object
An array of variables.
Instance Method Summary collapse
-
#initialize(variables, allocations) ⇒ AllocationSet
constructor
A new instance of AllocationSet.
- #length ⇒ Object
Constructor Details
#initialize(variables, allocations) ⇒ AllocationSet
Returns a new instance of AllocationSet.
14 15 16 17 18 19 |
# File 'lib/pg-verify/model/allocation_set.rb', line 14 def initialize(variables, allocations) if !allocations.empty? && variables.length != allocations.first.length raise "Variables and allocations must match in length!" end @variables, @allocations = variables, allocations end |
Instance Attribute Details
#allocations ⇒ Object
An array of allocations for those variables. Each allocation is a an array like [0, 1] where indices match the variable array to represent values for that variable
12 13 14 |
# File 'lib/pg-verify/model/allocation_set.rb', line 12 def allocations @allocations end |
#variables ⇒ Object
An array of variables
7 8 9 |
# File 'lib/pg-verify/model/allocation_set.rb', line 7 def variables @variables end |
Instance Method Details
#length ⇒ Object
21 22 23 |
# File 'lib/pg-verify/model/allocation_set.rb', line 21 def length() allocations.length end |