Class: Menuizer::Menu::Item
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Menuizer::Menu::Item
- Defined in:
- lib/menuizer/menu/item.rb
Instance Method Summary collapse
-
#initialize(opts) ⇒ Item
constructor
A new instance of Item.
- #path ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(opts) ⇒ Item
2 3 4 5 |
# File 'lib/menuizer/menu/item.rb', line 2 def initialize(opts) super @opts = opts end |
Instance Method Details
#path ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/menuizer/menu/item.rb', line 14 def path unless path = @opts[:path] case item when Symbol path = [item.to_s.pluralize.to_sym] end end if path if namespace [namespace[0..-2].to_sym,*path] else path end end end |
#title ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/menuizer/menu/item.rb', line 7 def title if title = @opts[:title] @opts[:title] else I18n.translate :"#{namespace}menuizer.#{item}", default: [:"activerecord.models.#{item}", "#{item}"] end end |