lib/chatterbot/skeleton.rb in chatterbot-0.7.1 vs lib/chatterbot/skeleton.rb in chatterbot-0.9.0
- old
+ new
@@ -14,20 +14,24 @@
})
puts opts.inspect
if RUBY_VERSION =~ /^1\.8\./
+ #:nocov:
apply_vars(src, opts)
+ #:nocov:
+
else
src % opts
end
end
#
# handle string interpolation in ruby 1.8. modified from
# https://raw.github.com/svenfuchs/i18n/master/lib/i18n/core_ext/string/interpolate.rb
#
+ #:nocov:
def apply_vars(s, args)
pattern = Regexp.union(
/%\{(\w+)\}/, # matches placeholders like "%{foo}"
/%<(\w+)>(.*?\d*\.?\d*[bBdiouxXeEfgGcps])/ # matches placeholders like "%<foo>.d"
)
@@ -45,8 +49,10 @@
raise KeyError unless args.has_key?(key)
$3 ? sprintf("%#{$3}", args[key]) : args[key]
end
end
end
+ #:nocov:
+
end
end
end