Class: EacTemplates::VariableProviders::Base

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

Direct Known Subclasses

EntriesReader, Generic, Hash

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Base

Returns a new instance of Base.



10
11
12
# File 'lib/eac_templates/variable_providers/base.rb', line 10

def initialize(source)
  @source = source
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



8
9
10
# File 'lib/eac_templates/variable_providers/base.rb', line 8

def source
  @source
end

Instance Method Details

#variable_value(name) ⇒ Object



14
15
16
17
18
# File 'lib/eac_templates/variable_providers/base.rb', line 14

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

  raise VariableNotFoundError, "Variable \"#{name}\" not found in #{source}"
end