bcavileer/hid

View on GitHub
lib/hid_core/persistence/memory/identifier.rb

Summary

Maintainability
A
0 mins
Test Coverage
module HidCore
  module Persistence
    module Memory
      class Identifier
        class << self
          attr_accessor :store

          def find_identity(input, type)
            (type_hash = store[type]) && type_hash[input]
          end

          def map(input, identity, type)
            type_hash = store[type] ||= Hash.new
            type_hash[input] = identity
            nil
          end
        end
      end
    end
  end
end