Class: Cmtool::Menu::EngineLink
- Inherits:
-
ElementBase
- Object
- ElementBase
- Cmtool::Menu::EngineLink
- Defined in:
- lib/cmtool/menu.rb
Overview
Engine link, links to an engine. Root by default
Instance Attribute Summary collapse
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
Instance Method Summary collapse
- #engine_link? ⇒ Boolean
-
#initialize(engine, options = {}) ⇒ EngineLink
constructor
A new instance of EngineLink.
- #path ⇒ Object
- #title ⇒ Object
Methods inherited from ElementBase
#controller_name, #controller_names, #method_missing, #options, #resource_link?
Constructor Details
#initialize(engine, options = {}) ⇒ EngineLink
Returns a new instance of EngineLink.
97 98 99 |
# File 'lib/cmtool/menu.rb', line 97 def initialize(engine, = {}) @engine, @options = engine, end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Cmtool::Menu::ElementBase
Instance Attribute Details
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
96 97 98 |
# File 'lib/cmtool/menu.rb', line 96 def engine @engine end |
Instance Method Details
#engine_link? ⇒ Boolean
101 102 103 |
# File 'lib/cmtool/menu.rb', line 101 def engine_link? true end |
#path ⇒ Object
110 111 112 113 114 115 116 |
# File 'lib/cmtool/menu.rb', line 110 def path case [:path] when Symbol then engine.routes.url_helpers.send(:"#{[:path]}_path") when String then [:path] else engine.routes.url_helpers.root_path end end |
#title ⇒ Object
106 107 108 |
# File 'lib/cmtool/menu.rb', line 106 def title [:title] || engine.name.split('::').first end |