Sha256: d82831fb90ece16bb2e2969e85162a9228040cc8b162bbec83bc37c3719ea33c

Contents?: true

Size: 552 Bytes

Versions: 1

Compression:

Stored size: 552 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.unshift namespace[0..-2].to_sym
        end
      end
      path
    else
      if model && model.model_name.respond_to?(:plural)
        :"#{namespace}#{model.model_name.plural}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
menuizer-0.2.2 lib/menuizer/menu/item.rb