Skip to content

Commit

Permalink
Merge pull request #139 from habemus-papadum/patch-1
Browse files Browse the repository at this point in the history
Check arity of :path method
  • Loading branch information
kojix2 authored Aug 4, 2019
2 parents 282f1be + 6813a10 commit 70ca17b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/iruby/display.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def format(mime = nil, &block)
obj.to_iruby
end

match {|obj| obj.respond_to?(:path) && File.readable?(obj.path) }
match {|obj| obj.respond_to?(:path) && obj.method(:path).arity == 0 && File.readable?(obj.path) }
format do |obj|
mime = MimeMagic.by_path(obj.path).to_s
[mime, File.read(obj.path)] if SUPPORTED_MIMES.include?(mime)
Expand Down

0 comments on commit 70ca17b

Please sign in to comment.