include list and dictionary as arr/hash
This commit is contained in:
parent
389b5f9e1a
commit
293ddb3b69
@ -47,24 +47,25 @@ module Sof
|
||||
o = Occurence.new( object , level )
|
||||
@objects[object.object_id] = o
|
||||
|
||||
# and recursively add attributes
|
||||
attributes = attributes_for(object)
|
||||
attributes.each do |a|
|
||||
val = get_value( object , a)
|
||||
add(val , level + 1)
|
||||
end
|
||||
# and array values
|
||||
if( object.is_a? Array )
|
||||
case object.class.name
|
||||
when "Array" , "Parfait::List"
|
||||
# and array values
|
||||
object.each do |a|
|
||||
add(a , level + 1)
|
||||
end
|
||||
end
|
||||
# and hash keys/values
|
||||
if( object.is_a? Hash )
|
||||
when "Hash" , "Parfait::Dictionary"
|
||||
# and hash keys/values
|
||||
object.each do |a,b|
|
||||
add(a , level + 1)
|
||||
add(b , level + 1)
|
||||
end
|
||||
else
|
||||
# and recursively add attributes
|
||||
attributes = attributes_for(object)
|
||||
attributes.each do |a|
|
||||
val = get_value( object , a)
|
||||
add(val , level + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user