Module: NoBrainer::Document::Core

Extended by:
ActiveSupport::Concern
Defined in:
lib/no_brainer/document/core.rb

Class Method Summary collapse

Class Method Details

.all(options = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/no_brainer/document/core.rb', line 24

def self.all(options={})
  (options[:types] || [:user]).map do |type|
    case type
    when :user
      Rails.application.eager_load! if defined?(Rails.application.eager_load!)
      _all
    when :nobrainer
      [NoBrainer::Document::Index::MetaStore, NoBrainer::Lock]
    when :system
      NoBrainer::System.constants
        .map { |c| NoBrainer::System.const_get(c) }
        .select { |m| m < NoBrainer::Document }
    end
  end.reduce([], &:+)
end