Class: Godmin::EngineWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/godmin/engine_wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#engineObject (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

#namespaceObject



9
10
11
# File 'lib/godmin/engine_wrapper.rb', line 9

def namespace
  @namespace ||= engine.railtie_namespace
end

#namespaced?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/godmin/engine_wrapper.rb', line 13

def namespaced?
  @namespaced ||= namespace.present?
end

#namespaced_pathObject



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

#rootObject



27
28
29
# File 'lib/godmin/engine_wrapper.rb', line 27

def root
  engine.root
end