some docs

This commit is contained in:
Torsten Ruger
2016-12-06 11:38:09 +02:00
parent 229f5896c6
commit 4b05b48197
17 changed files with 71 additions and 101 deletions

View File

@ -1,19 +1,18 @@
# various classes would derive from array in ruby, ie have indexed variables
#
# But for our memory type we need the variable part of an object to be after
# the fixed, ie the instance variables
#
# Just using ruby derivation will not allow us to offset the index, so instead the
# function will be generated and included to the classes that need them.
#
# Using ruby include does not work for similar reasons, so Indexed.at is the main
# function that generates the methods
# ( do have to use a marker module so we can test with is_a?)
module Parfait
# Various classes would derive from array in ruby, ie have indexed variables
#
# But for our memory type we need the variable part of an object to be after
# the fixed, ie the instance variables
#
# Just using ruby derivation will not allow us to offset the index, so instead the
# function will be generated and included to the classes that need them.
#
# Basic functionality depends on the offset, and those methods are generated by
# the offset method that has to be called seperately when including this Module
module Indexed # marker module
def self.included(base)
base.extend(Methods)
base.extend(OffsetMethods)
base.attribute :indexed_length
end
@ -137,7 +136,9 @@ module Parfait
ret
end
module Methods
module OffsetMethods
# generate all methods that depend on the (memory) offset
# These are get/set shrink_to/grow_to
def offset( offset )
offset += 1 # for the attribute we add (indexed_length)