Skip to content

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

Description

@paulie4

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions