Sha256: 28ac64fbc31fafbf3dde895ae02b53265aa465f4d88e421dba79aa9d5653a85a

Contents?: true

Size: 722 Bytes

Versions: 2

Compression:

Stored size: 722 Bytes

Contents

require_relative 'dispatcher'
require_relative 'adapters/dashboard_adapter'
require_relative 'adapters/dropdown_adapter'

module StructuredMenus
  @config = nil

  def self.config
    @config
  end

  def self.config=(val)
    @config = val
  end

  class Configurator
    attr_accessor :menus_directory, :adapters

    def initialize
      @menus_directory = Rails.root.join('app/menus')
      @adapters = [Adapters::DashboardAdapter, Adapters::DropdownAdapter]
    end

    def self.configure
      inst = new
      yield inst
      StructuredMenus.config = inst

      Rails.module_eval do
        @menus = StructuredMenus::Dispatcher.new

        def self.menus
          @menus
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
structured_menus-0.0.2 lib/structured_menus/configurator.rb
structured_menus-0.0.1 lib/structured_menus/configurator.rb