Sha256: eeba937e166c7c5f5d810add42f9584f44e57d894f3dfd2c7abd2aa84b268083

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

module Ramenu
  # A menu definer to create menus in a block
  class RamenuDefiner
    attr_accessor :menus, :flags, :options

    def initialize(menus, flags, options = {})
      self.menus = menus
      self.flags = flags
      self.options = options
    end

    # create a new flag in a block
    def set_flag(name, value = nil, options = {})
      Ramenu.set_flag_in(flags, name, value, options)
    end

    # create a new menu in a block
    def add_menu(name, path = nil, options = {}, &block)
      options[:flag] = name if @options[:flag_for_menu] == true && name.is_a?(Symbol)
      Ramenu.add_menu_to(menus, name, path, options, &block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ramenu-3.0.0 lib/ramenu/ramenu_definer.rb