Module: EacRubyUtils::Templates::VariableProviders

Defined in:
lib/eac_ruby_utils/templates/variable_providers.rb,
lib/eac_ruby_utils/templates/variable_providers/base.rb,
lib/eac_ruby_utils/templates/variable_providers/hash.rb,
lib/eac_ruby_utils/templates/variable_providers/generic.rb,
lib/eac_ruby_utils/templates/variable_providers/entries_reader.rb

Defined Under Namespace

Classes: Base, EntriesReader, Generic, Hash

Constant Summary collapse

PROVIDERS =
%w[entries_reader hash generic].map do |name|
  "eac_ruby_utils/templates/variable_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_ruby_utils/templates/variable_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