/[freeride]/freeride/freebase/databus.rb
ViewVC logotype

Diff of /freeride/freebase/databus.rb

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by richkilmer, Wed Sep 25 14:34:53 2002 UTC revision 1.14 by richkilmer, Fri Sep 27 06:48:05 2002 UTC
# Line 162  module FreeBASE Line 162  module FreeBASE
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)
# Line 217  module FreeBASE Line 229  module FreeBASE
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

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26