Sha256: 88236c388f435f25b7c1d0f06a5f5ed606939a806e57e8e2fdae15f5724f5916

Contents?: true

Size: 514 Bytes

Versions: 2

Compression:

Stored size: 514 Bytes

Contents

# frozen_string_literal: true

module Satis
  module Menus
    class Menu
      attr_reader :items, :level

      def initialize(*args, **kwargs)
        @options = args.extract_options!
        @items = []
        @scope = Array.wrap(args.first)
        @level = kwargs[:level] || 0
        yield self if block_given?
      end

      def item(*args, **kwargs, &block)
        kwargs[:scope] = @scope
        kwargs[:level] = @level
        @items << Item.new(*args, **kwargs, &block)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
satis-1.0.67 lib/satis/menus/menu.rb
satis-1.0.66 lib/satis/menus/menu.rb