Class: EacTemplates::VariableProviders::ConfigReader

Inherits:
Base
  • Object
show all
Defined in:
lib/eac_templates/variable_providers/config_reader.rb

Instance Attribute Summary

Attributes inherited from Base

#source

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #variable_value

Constructor Details

This class inherits a constructor from EacTemplates::VariableProviders::Base

Class Method Details

.accept?(variables_source) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
# File 'lib/eac_templates/variable_providers/config_reader.rb', line 10

def accept?(variables_source)
  return false unless variables_source.respond_to?(:entry)

  entry = variables_source.entry(:any_value)
  entry.respond_to?(:value) && entry.respond_to?(:found?)
end

Instance Method Details

#variable_exist?(name) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/eac_templates/variable_providers/config_reader.rb', line 18

def variable_exist?(name)
  source.entry(name).found?
end

#variable_fetch(name) ⇒ Object



22
23
24
# File 'lib/eac_templates/variable_providers/config_reader.rb', line 22

def variable_fetch(name)
  source.entry(name).value
end