Sha256: 79515f3425269d53e8cff3be46ab8bdc5e68a7cdbb9df17b4a3c2954a900a25b

Contents?: true

Size: 639 Bytes

Versions: 7

Compression:

Stored size: 639 Bytes

Contents

module NiceAdmin
  class Engine < Rails::Engine
    engine_name :nice_admin
  end
  
  def self.included(base)
    base.send(:extend, ClassMethods)
  end
  mattr_accessor :nav_items
  @@nav_items = {}
  
  mattr_accessor :site_title
  @@site_title = 'Nice Admin'
  
  mattr_accessor :site_name
  @@site_name = 'NiceA dminn'
end

module ClassMethods
  def nice_admin_nav(&block)
    hash = OptionsHash.new
    block.call(hash)
    NiceAdmin.nav_items = hash.opts
  end
end

class OptionsHash
  attr_accessor :opts

  def initialize
    @opts = {}
  end

  def method_missing(sym, *args)
    @opts[args.first.to_s] = args.last.to_s
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nice_admin-0.0.7 lib/nice_admin.rb
nice_admin-0.0.6 lib/nice_admin.rb
nice_admin-0.0.5 lib/nice_admin.rb
nice_admin-0.0.4 lib/nice_admin.rb
nice_admin-0.0.3 lib/nice_admin.rb
nice_admin-0.0.2 lib/nice_admin.rb
nice_admin-0.0.1 lib/nice_admin.rb