diff options
Diffstat (limited to 'lib/trocla.rb')
-rw-r--r-- | lib/trocla.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/trocla.rb b/lib/trocla.rb index a239be8..8d916b2 100644 --- a/lib/trocla.rb +++ b/lib/trocla.rb @@ -27,7 +27,7 @@ class Trocla elsif !options['random'] && plain_pwd.nil? raise "Password must be present as plaintext if you don't want a random password" end - set_password(key,format,Trocla::Formats[format].format(plain_pwd,options)) + set_password(key,format,self.formats(format).format(plain_pwd,options)) end def get_password(key,format) @@ -58,6 +58,10 @@ class Trocla h[format] end + def formats(format) + (@format_cache||={})[format] ||= Trocla::Formats[format].new(self) + end + private def cache @cache ||= build_cache |