Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
File/IO readlines supporting new params limit, and open mode #650
@josedonizetti This patch looks good but there is one problem with it. The @JRubyMethod annotations for both of those method bindings will work in both 1.8 and 1.9 mode. The new argument support you are adding should only work for 1.9 mode.
Could you refactor this to support both modes (You can see an example of this splitting in RubyIO.sysopen()/RubyIO.sysopen19())? Mostly this just means having 4 Java methods 2 for 1.8 and 2 for 1.9 with usually a common method which can perform the work. Be aware due to backwards compat that the original Java method names for these need to keep their names and the same method signature. The 1.9 versions can be labelled readlines19().
@enebo With this last commit, the support is exclusive for 1.9 not affecting 1.8 at all. Also I've fixed all the specs related to IO.readlines but two. One because of enconding, when reading the files at the time of comparing the characters are all corrupted and the other because JRuby don't yet support IO.popen("-") we get this error on the 1.8 as well. Let me know if anything. Thanks!