blambeau/alf — pull request #1 by eregon (2011-10-22 16:05:10+00:00)
Title: accept any kind of path for Alf::Reader.reader

The documentation should be updated, but I don't speak (yet) YARD, so please teach me.

:to_str is used in 1.8, :to_path in 1.9.

This is an easy way (because it converts directly to String) to solve the current situation with Viiite.
Alf should ideally support paths everywhere, but Ruby is not really helpful here (there should be a class for paths, which would avoid the confusion between String (potentially IO contents) and paths), and you would need to check like I do here everywhere you use a path.

If used in a case statement, you could probably define something like

```ruby
KindOfPath = lambda do |path|
path.respond_to? :to_str or path.respond_to? :to_path
end

case path
-when String
+when KindOfPath
end

-if path.is_a? String
+if KindOfPath === path
```