some docs
This commit is contained in:
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user