Closed krainboltgreene closed 8 years ago
I think really we should be moving away from explicit type checking and towards duck typing.
Looking at how OpenURI handles this problem, it checks for the open()
method (which is supported by Pathname
and IO
objects) and failing that it checks for to_str()
(which is supported by strings and Pathname
in ruby prior to 1.9).
This method is a bit of a mess, it should probably be checking for supported methods (like OpenURI
does) rather than using rescue instead of conditionals and rescue statements for flow control.
I agree with @iainbeeston, I think it's the most flexible way and having rescue for control flow is really a code smell.
I'm going to close this for now. Feel free to open another PR
This is rather disappointing. On Jan 8, 2016 2:50 AM, "Iain Beeston" notifications@github.com wrote:
I'm going to close this for now. Feel free to open another PR
— Reply to this email directly or view it on GitHub https://github.com/ruby-json-schema/json-schema/pull/274#issuecomment-169962136 .
If you have time to make a new pull request that uses duck-typing rather than explicit type checking and we'll be more than happy to look at it
Strings are naive path names, and in Ruby we have an object specifically for path names called Pathname.