Class: TfOutputs::Configurator::StateReader

Inherits:
Object
  • Object
show all
Defined in:
lib/tfoutputs/configurator/state_reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_paths) ⇒ StateReader



8
9
10
11
12
13
# File 'lib/tfoutputs/configurator/state_reader.rb', line 8

def initialize(file_paths)
  @file_paths = file_paths
  @outputs = []
  get_outputs_from_file
  self
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (protected)



43
44
45
46
47
48
49
50
51
# File 'lib/tfoutputs/configurator/state_reader.rb', line 43

def method_missing(name, *args, &block)
  #  Hack - really we should call respond_to?
  outputs.each do |output|
    next unless output.keys[0] == name.to_s
    return 'sensitive' if output[name.to_s]['sensitive']
    return output[name.to_s]['value']
  end
  super(name, *args, &block)
end

Instance Attribute Details

#file_pathsObject

Returns the value of attribute file_paths.



6
7
8
# File 'lib/tfoutputs/configurator/state_reader.rb', line 6

def file_paths
  @file_paths
end

#outputsObject

Returns the value of attribute outputs.



6
7
8
# File 'lib/tfoutputs/configurator/state_reader.rb', line 6

def outputs
  @outputs
end

Instance Method Details

#respond_to?(method, include_private = false) ⇒ Boolean



15
16
17
18
19
20
21
# File 'lib/tfoutputs/configurator/state_reader.rb', line 15

def respond_to? (method, include_private = false)
  outputs.each do |output|
    next unless output.keys[0] == method.to_s
    return true
  end
  super
end