Module: IncludeFor

Defined in:
lib/include_for.rb

Overview

IncludeFor

Instance Method Summary collapse

Instance Method Details

#include_for(*sources) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/include_for.rb', line 3

def include_for(*sources)
  sources = sources.flatten
  options = sources.last.is_a?(Hash) ? sources.pop.symbolize_keys : {}
  group   = options.delete(:to) || :header
  global_cache  = eval("@_include_for_#{options[:to]}_ ||= {}")
  private_cache = {}

  loadeds = sources.map do |source|
    include_for_cache_or_find(group, source, options, global_cache, private_cache)
  end
  loadeds.compact
end