Module: ThinkFeelDoEngine::Reports::ToolModule

Included in:
ModulePageView, ModuleSession
Defined in:
app/models/think_feel_do_engine/reports/tool_module.rb

Overview

Helper methods for reporting on modules. rubocop:disable Lint/NestedMethodDefinition

Constant Summary collapse

URL_ROOT_RE =
%r{^[^\/]*\/\/[^\/]+}

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/models/think_feel_do_engine/reports/tool_module.rb', line 9

def self.included(klass)
  class << klass
    # Returns a hash mapping path to Tool Module.
    def modules_map
      tool_modules.each_with_object({}) do |m, h|
        h[url_helpers.navigator_location_path(module_id: m.id)] = m
      end
    end

    private

    def tool_modules
      BitCore::ContentModule.where(type: nil)
    end

    def url_helpers
      ThinkFeelDoEngine::Engine.routes.url_helpers
    end
  end
end