class Trocla::Encryptions
Public Class Methods
[](enc)
click to toggle source
# File lib/trocla/encryptions.rb, line 20 def [](enc) encryptions[enc.to_s.downcase] end
all()
click to toggle source
# File lib/trocla/encryptions.rb, line 24 def all Dir[ path '*' ].collect do |enc| File.basename(enc, '.rb').downcase end end
available?(encryption)
click to toggle source
# File lib/trocla/encryptions.rb, line 30 def available?(encryption) all.include?(encryption.to_s.downcase) end
Private Class Methods
encryptions()
click to toggle source
# File lib/trocla/encryptions.rb, line 35 def encryptions @@encryptions ||= Hash.new do |hash, encryption| encryption = encryption.to_s.downcase if File.exists?( path encryption ) require "trocla/encryptions/#{encryption}" class_name = "Trocla::Encryptions::#{encryption.capitalize}" hash[encryption] = (eval class_name) else raise "Encryption #{encryption} is not supported!" end end end
path(encryption)
click to toggle source
# File lib/trocla/encryptions.rb, line 48 def path(encryption) File.expand_path( File.join(File.dirname(__FILE__), 'encryptions', "#{encryption}.rb") ) end