Sha256: 5006bbb0d78740cd2a240d4b406b118a4e8f633f0c31faba39354769b4047a2e

Contents?: true

Size: 431 Bytes

Versions: 2

Compression:

Stored size: 431 Bytes

Contents

# frozen_string_literal: true

require 'clowne/ext/record_key'

module Clowne
  module Utils
    class CloneMapper # :nodoc: all
      def initialize
        @store = {}
      end

      def add(origin, clone)
        @store[origin] ||= clone
      end

      def clone_of(origin)
        @store[origin]
      end

      def origin_of(clone)
        origin, _clone = @store.rassoc(clone)
        origin
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clowne-1.1.0 lib/clowne/utils/clone_mapper.rb
clowne-1.0.0 lib/clowne/utils/clone_mapper.rb