Sha256: 44dbee8f51fded28e4b357d326e4230ea7a556fab1dc9057569c5844ec15d67b
Contents?: true
Size: 700 Bytes
Versions: 17
Compression:
Stored size: 700 Bytes
Contents
# frozen_string_literal: true require_relative "./common" module Fixtury module LocatorBackend class Memory include ::Fixtury::LocatorBackend::Common MATCHER = /^fixtury-oid-(?<object_id>[\d]+)$/.freeze def recognized_reference?(ref) ref.is_a?(String) && MATCHER.match?(ref) end def recognized_value?(_val) true end def load_recognized_reference(ref) match = MATCHER.match(ref) return nil unless match ::ObjectSpace._id2ref(match[:object_id].to_i) rescue RangeError nil end def dump_recognized_value(value) "fixtury-oid-#{value.object_id}" end end end end
Version data entries
17 entries across 17 versions & 1 rubygems