Sha256: df387c33e612a472adad8791bc6fc9769abb542185cc73b240c1344654e4a930
Contents?: true
Size: 816 Bytes
Versions: 57
Compression:
Stored size: 816 Bytes
Contents
require 'erb' require_relative 'in_memory_repository' require_relative '../entities/preset' module Inferno module Repositories # Repository that deals with persistence for the `Preset` entity. class Presets < InMemoryRepository def insert_from_file(path) case path when /\.json$/ preset_hash = JSON.parse(File.read(path)) when /\.erb$/ templated = ERB.new(File.read(path)).result preset_hash = JSON.parse(templated) end preset_hash.deep_symbolize_keys! preset_hash[:id] ||= SecureRandom.uuid preset = Entities::Preset.new(preset_hash) insert(preset) end def presets_for_suite(suite_id) all.select { |preset| preset.test_suite_id.to_s == suite_id.to_s } end end end end
Version data entries
57 entries across 57 versions & 1 rubygems