Class: WSDirector::ScenarioReader

Inherits:
Object
  • Object
show all
Extended by:
Utils
Defined in:
lib/wsdirector/scenario_reader.rb

Overview

Read and parse YAML scenario

Constant Summary

Constants included from Utils

Utils::MULTIPLIER_FORMAT

Class Method Summary collapse

Methods included from Utils

parse_multiplier

Class Method Details

.parse(file_path) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/wsdirector/scenario_reader.rb', line 11

def parse(file_path)
  contents = ::YAML.load(ERB.new(File.read(file_path)).result) # rubocop:disable Security/YAMLLoad

  if contents.first.key?("client")
    parse_multiple_scenarios(contents)
  else
    {"total" => 1, "clients" => [parse_simple_scenario(contents)]}
  end
end