add next_value for dictionary
also next for list and add types attributes to space
This commit is contained in:
@ -30,6 +30,10 @@ module Parfait
|
||||
return @keys.get_length()
|
||||
end
|
||||
|
||||
def next_value(val)
|
||||
return @values.next_value(val)
|
||||
end
|
||||
|
||||
# get a value fot the given key
|
||||
# key identity is checked with == not === (ie equals not identity)
|
||||
# return nil if no such key
|
||||
|
@ -78,7 +78,7 @@ module Parfait
|
||||
end
|
||||
|
||||
# include? means non nil index
|
||||
def include? item
|
||||
def include?( item )
|
||||
return index_of(item) != nil
|
||||
end
|
||||
|
||||
@ -97,6 +97,14 @@ module Parfait
|
||||
return nil
|
||||
end
|
||||
|
||||
# return the next of given. Nil if item not in list or there is not next
|
||||
def next_value(val)
|
||||
index = index_of(val)
|
||||
return nil unless index
|
||||
return nil if index == get_length
|
||||
return get(index + 1)
|
||||
end
|
||||
|
||||
# push means add to the end
|
||||
# this automatically grows the List
|
||||
def push( value )
|
||||
|
@ -50,7 +50,7 @@ module Parfait
|
||||
@nil_object = Parfait::NilClass.new
|
||||
end
|
||||
|
||||
attr_reader :classes , :first_message , :next_integer
|
||||
attr_reader :classes , :types , :first_message , :next_integer
|
||||
attr_reader :true_object , :false_object , :nil_object
|
||||
|
||||
def each_type
|
||||
|
Reference in New Issue
Block a user