Class: Godmin::EngineWrapper
- Inherits:
-
Object
- Object
- Godmin::EngineWrapper
- Defined in:
- lib/godmin/engine_wrapper.rb
Instance Attribute Summary collapse
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
Instance Method Summary collapse
-
#initialize(controller) ⇒ EngineWrapper
constructor
A new instance of EngineWrapper.
- #namespace ⇒ Object
- #namespaced? ⇒ Boolean
- #namespaced_path ⇒ Object
- #root ⇒ Object
Constructor Details
#initialize(controller) ⇒ EngineWrapper
Returns a new instance of EngineWrapper.
5 6 7 |
# File 'lib/godmin/engine_wrapper.rb', line 5 def initialize(controller) @engine = find_engine(controller) end |
Instance Attribute Details
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
3 4 5 |
# File 'lib/godmin/engine_wrapper.rb', line 3 def engine @engine end |
Instance Method Details
#namespace ⇒ Object
9 10 11 |
# File 'lib/godmin/engine_wrapper.rb', line 9 def namespace @namespace ||= engine.railtie_namespace end |
#namespaced? ⇒ Boolean
13 14 15 |
# File 'lib/godmin/engine_wrapper.rb', line 13 def namespaced? @namespaced ||= namespace.present? end |
#namespaced_path ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/godmin/engine_wrapper.rb', line 17 def namespaced_path @namespaced_path ||= begin if namespaced? namespace.name.split("::").map(&:underscore) else [] end end end |
#root ⇒ Object
27 28 29 |
# File 'lib/godmin/engine_wrapper.rb', line 27 def root engine.root end |