lib/xml/kit/crypto.rb in xml-kit-0.1.14 vs lib/xml/kit/crypto.rb in xml-kit-0.2.0
- old
+ new
@@ -12,8 +12,22 @@
# @!visibility private
def self.cipher_for(algorithm, key)
CIPHERS.find { |x| x.matches?(algorithm) }.new(algorithm, key)
end
+
+ def self.cipher_registry(&block)
+ BlockRegistry.new(&block)
+ end
+
+ class BlockRegistry
+ def initialize(&factory)
+ @factory = factory
+ end
+
+ def cipher_for(algorithm, key)
+ @factory.call(algorithm, key)
+ end
+ end
end
end
end