lib/cliutils/prefs/pref.rb in cliutils-1.2.6 vs lib/cliutils/prefs/pref.rb in cliutils-1.2.7

- old
+ new

@@ -68,12 +68,18 @@ # @param [String] text The text to evaluate # @return [String] def evaluate_behaviors(text) if @behaviors modified_text = text - @behaviors.each do |b| - if PrefBehavior.respond_to?(b) - modified_text = PrefBehavior.send(b, modified_text) + @behaviors.each do |method| + if method.is_a?(Hash) + parameter = method.values[0] + method = method.keys[0] + end + + args = [modified_text, parameter] + if PrefBehavior.respond_to?(method) + modified_text = PrefBehavior.send(method, *args) else messenger.warn("Skipping undefined Pref behavior: #{ b }") end end modified_text