lib/filemagic.rb in ruby-filemagic-0.6.0 vs lib/filemagic.rb in ruby-filemagic-0.6.1
- old
+ new
@@ -51,14 +51,16 @@
class << self
# Provide a "magic singleton".
def fm(*flags)
- if fm = @fm[flags = flags(flags)]
+ options = flags.last.is_a?(Hash) ? flags.pop : {}
+
+ if fm = @fm[key = [flags = flags(flags), options]]
return fm unless fm.closed?
end
- @fm[flags] = new(flags)
+ @fm[key] = new(flags, options)
end
# Clear our instance cache.
def clear!
@fm.each_value(&:close).clear