divergence icon indicating copy to clipboard operation
divergence copied to clipboard

cache_manager.rb:48: syntax error, unexpected '.', expecting kEND

Open paulie4 opened this issue 12 years ago • 2 comments

I don't know if it's just my version of ruby (1.8.7), but it does not like a method call being on a separate line from its object, so this block of code is causing it to crash:

        branches
          .sort_by {|f| File.mtime(f)}[@cache_num..-1]
          .each do|dir|
            FileUtils.rm_rf(dir)
            @cached_branches.delete(dir.gsub('/', ''))
          end

To fix it, I just escaped the end-of-lines for the first two lines, like this:

        branches \
          .sort_by {|f| File.mtime(f)}[@cache_num..-1] \
          .each do|dir|
            FileUtils.rm_rf(dir)
            @cached_branches.delete(dir.gsub('/', ''))
          end

paulie4 avatar Nov 02 '12 21:11 paulie4

Divergence was developed with Ruby 1.9 in mind. Going back and testing Ruby 1.8 support is something that is being considered.

meltingice avatar Nov 03 '12 16:11 meltingice

If you could throw this into a pull request, that would help out immensely!

meltingice avatar Nov 03 '12 16:11 meltingice