Class: TyranoDsl::ElementsWriters::VariablesWriter

Inherits:
Object
  • Object
show all
Includes:
ElementsWritersModule
Defined in:
lib/tyrano_dsl/elements_writers/variables_writer.rb

Overview

Write a variable

Instance Method Summary collapse

Instance Method Details

#write(world) ⇒ Array

Parameters:

Returns:

  • (Array)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tyrano_dsl/elements_writers/variables_writer.rb', line 12

def write(world)
  log {'Writing variables'}
  variable_content = {}
  world.variables.values.each do |variable|
    variable_content[variable.target_name] = {
        :val => variable.initial_value,
        :kind => 'f'
    }
  end
  [
      TyranoDsl::FileActions::JsonPatch.new(
          'builder_config.json',
          ['map_var'],
          variable_content
      )
  ]
end