fix layout

amazing at this stage, but yet another index error
the strange (and wonderful) thing is that changing the return
of the one function just shifts the variables and everything else
stays intact. Thus are the wonders of object orientation
This commit is contained in:
Torsten Ruger
2015-10-17 10:03:39 +03:00
parent 17545d1525
commit 4ce4775902
2 changed files with 30 additions and 7 deletions

View File

@ -62,12 +62,13 @@ module Parfait
raise "should not rely on layout internal structure, use variable_index"
end
# index of a variable name into the layout.
# layout is a list, so lowest index is 1
# :layout is a variable for every object, so 1 is taken for :layout
# still, the index is the same.
# index of the variable when using internal_object_get
# (internal_object_get is 1 based and 1 is always the layout)
def variable_index name
list_index(name)
has = list_index(name)
return nil unless has
raise "internal error #{name}:#{has}" if has < 2
has - 1
end
def inspect