162 |
end |
end |
163 |
|
|
164 |
## |
## |
165 |
|
# Checks if this slot has a child slot of the given name |
166 |
|
# |
167 |
|
# name:: [String] The name of the child slot |
168 |
|
# return:: [Boolean] True if child slot exists, otherwise false |
169 |
|
# |
170 |
|
def has_child?(name) |
171 |
|
result = @slots[name] |
172 |
|
result = @links[name] unless result |
173 |
|
return result ? true : false |
174 |
|
end |
175 |
|
|
176 |
|
## |
177 |
# Navigates to a path (relative) to the current object (with DataBus as root) |
# Navigates to a path (relative) to the current object (with DataBus as root) |
178 |
# |
# |
179 |
# path:: [String] The path (i.e. /foo/bar or foo/bar) |
# path:: [String] The path (i.e. /foo/bar or foo/bar) |
229 |
# |
# |
230 |
def each_slot(recurse=false, &block) |
def each_slot(recurse=false, &block) |
231 |
raise "Must supply a block as an iterator" unless block_given? |
raise "Must supply a block as an iterator" unless block_given? |
232 |
@slots.each_value do |slot| |
@slots.keys.sort.each do |name| |
233 |
|
slot = @slots[name] |
234 |
yield slot |
yield slot |
235 |
slot.each_slot(recurse, &block) if recurse |
slot.each_slot(recurse, &block) if recurse |
236 |
end |
end |
237 |
@links.each_value do |slot| |
@links.keys.sort.each do |name| |
238 |
|
slot = @links[name] |
239 |
yield slot |
yield slot |
240 |
slot.each_slot(recurse, &block) if recurse |
slot.each_slot(recurse, &block) if recurse |
241 |
end |
end |