Sha256: 6bd02eeebae63473b5e40a639450f49a380fc4cb6f772ac664d2bb57e64f9d6a

Contents?: true

Size: 472 Bytes

Versions: 2

Compression:

Stored size: 472 Bytes

Contents

module Redcar
  class Menu
    attr_reader :text, :entries
  
    # A Menu will initially have nothing in it.
    def initialize(text="")
      @text, @entries = text, []
    end
  
    # Iterate over each entry
    def each
      @entries.each {|e| yield e}
    end
  
    # Add a Redcar::MenuItem or a Redcar::Menu
    def <<(entry)
      @entries << entry
      self
    end
  
    # Number of entries in the menu
    def length
      @entries.length
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redcar-0.3.0dev plugins/application/lib/application/menu.rb
redcar-0.2.9dev plugins/application/lib/application/menu.rb