Module: EacTemplates::Variables::Providers

Defined in:
lib/eac_templates/variables/providers.rb,
lib/eac_templates/variables/providers/base.rb,
lib/eac_templates/variables/providers/hash.rb,
lib/eac_templates/variables/providers/generic.rb,
lib/eac_templates/variables/providers/config_reader.rb,
lib/eac_templates/variables/providers/entries_reader.rb

Defined Under Namespace

Classes: Base, ConfigReader, EntriesReader, Generic, Hash

Constant Summary collapse

PROVIDERS =
%w[config_reader entries_reader hash generic].map do |name|
  "eac_templates/variables/providers/#{name}".camelize.constantize
end

Class Method Summary collapse

Class Method Details

.build(variables_source) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/eac_templates/variables/providers.rb', line 15

def build(variables_source)
  PROVIDERS.each do |provider|
    return provider.new(variables_source) if provider.accept?(variables_source)
  end

  raise "Variables provider not found for #{variables_source}"
end