class Patterns::Composite
Acts as a root or branch for a composite structure
Public Class Methods
          new(name)
          
          click to toggle source
          
        
        
        Initializes the Composite class
              Calls superclass method
              
            
          
          
          # File app/models/composite/composite.rb, line 10 def initialize(name) super(name) end
Public Instance Methods
          display(depth)
          
          click to toggle source
          
        
        
        Displays this composite and each of its children up to their proper depth
# File app/models/composite/composite.rb, line 15 def display(depth) str = '' depth.times do str << '-' end puts str + @name @children.each do |child| child.display(depth + 2) end end