lib/to_pass/converter.rb in to_pass-0.6.0 vs lib/to_pass/converter.rb in to_pass-0.7.0
- old
+ new
@@ -1,7 +1,6 @@
-# -*- coding: utf-8 -*-
-# vim:ft=ruby:enc=utf-8
+# vim:ft=ruby:fileencoding=utf-8
module ToPass # :nodoc:
# converts a given string into a password-like word
#
# the string can be a word or a sentence. everthing which
@@ -68,10 +67,14 @@
end
end
# apply a single rule to the password-to-be
def apply_rule(pwd, rule)
- cmd, args = rule.to_a.flatten
+ cmd, args = if rule.respond_to?(:to_a)
+ rule.to_a.flatten
+ else
+ [ rule, nil ]
+ end
m = @reader.load(cmd.to_sym).method(cmd.to_sym)
case m.arity
when 1
m.call(pwd)