Sha256: 8d9363f259ecc77a0a1986c90b9eeeab485004193e56c2189554c55e5359ed08

Contents?: true

Size: 431 Bytes

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
clowne-1.5.0 lib/clowne/utils/clone_mapper.rb
clowne-1.4.0 lib/clowne/utils/clone_mapper.rb
clowne-1.3.0 lib/clowne/utils/clone_mapper.rb
clowne-1.2.0 lib/clowne/utils/clone_mapper.rb