Sha256: 0c74e26f1c27d8e1f61bdeba943d6baf192db72538be6f7aae6a59062d7cefc0

Contents?: true

Size: 554 Bytes

Versions: 5

Compression:

Stored size: 554 Bytes

Contents

class Menuizer::Menu::Item < OpenStruct
  def initialize(opts)
    super
    @opts = opts
  end

  def title
    if model && model.model_name.respond_to?(:human)
      model.model_name.human
    else
      @opts[:title]
    end
  end
  def path
    if path = @opts[:path]
      if path.respond_to?(:unshift)
        if namespace
          path = [namespace[0..-2].to_sym,*path]
        end
      end
      path
    else
      if model && model.model_name.respond_to?(:plural)
        :"#{namespace}#{model.model_name.plural}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
menuizer-0.2.7 lib/menuizer/menu/item.rb
menuizer-0.2.6 lib/menuizer/menu/item.rb
menuizer-0.2.5 lib/menuizer/menu/item.rb
menuizer-0.2.4 lib/menuizer/menu/item.rb
menuizer-0.2.3 lib/menuizer/menu/item.rb