Sha256: 08b2696ca159e1685f6fe95efd7f75547202604b2c0e266b15570599400b2662
Contents?: true
Size: 745 Bytes
Versions: 11
Compression:
Stored size: 745 Bytes
Contents
# frozen_string_literal: true module Shark module RSpec module FakeSurveyService class ObjectCache include Singleton attr_accessor :objects def initialize @objects = [] end def self.clear instance.objects = [] end def add(payload) payload['id'] = SecureRandom.uuid if payload['id'].blank? objects << payload unless objects.detect { |o| o['id'] == id } payload end def find(id, type) objects.detect { |o| o['id'] == id && o['type'] == type } end def remove(id, type) objects.delete_if { |o| o['id'] == id && o['type'] == type } end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems