Class: EacTemplates::Variables::Providers::ConfigReader

Inherits:
Base
  • Object
show all
Defined in:
lib/eac_templates/variables/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::Variables::Providers::Base

Class Method Details

.accept?(variables_source) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
# File 'lib/eac_templates/variables/providers/config_reader.rb', line 11

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)


19
20
21
# File 'lib/eac_templates/variables/providers/config_reader.rb', line 19

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

#variable_fetch(name) ⇒ Object



23
24
25
# File 'lib/eac_templates/variables/providers/config_reader.rb', line 23

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