Class: EacTemplates::Variables::Providers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_templates/variables/providers/base.rb

Direct Known Subclasses

ConfigReader, EntriesReader, Generic, Hash

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Base

Returns a new instance of Base.



11
12
13
# File 'lib/eac_templates/variables/providers/base.rb', line 11

def initialize(source)
  @source = source
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



9
10
11
# File 'lib/eac_templates/variables/providers/base.rb', line 9

def source
  @source
end

Instance Method Details

#variable_value(name) ⇒ Object



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

def variable_value(name)
  return variable_fetch(name) if variable_exist?(name)

  raise ::EacTemplates::Variables::NotFoundError,
        "Variable \"#{name}\" not found in #{source}"
end