Sha256: 0e6a4fb1716fe9ee4690537a324f454db315a7a5f10d8df75132c9e3bb82c5e1

Contents?: true

Size: 566 Bytes

Versions: 6

Compression:

Stored size: 566 Bytes

Contents

# frozen_string_literal: true
module Cucumber
  module Cli
    class RerunFile
      attr_reader :path

      def self.can_read?(path)
        path[0] == '@' && File.file?(real_path(path))
      end

      def self.real_path(path)
        path[1..-1] # remove leading @
      end

      def initialize(path)
        @path = self.class.real_path(path)
      end

      def features
        lines.map { |l| l.scan(/(?:^| |)(.*?\.feature(?:(?::\d+)*))/) }.flatten
      end

      private

      def lines
        IO.read(@path).split("\n")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cucumber-3.1.0 lib/cucumber/cli/rerun_file.rb
cucumber-3.0.2 lib/cucumber/cli/rerun_file.rb
cucumber-3.0.1 lib/cucumber/cli/rerun_file.rb
cucumber-3.0.0 lib/cucumber/cli/rerun_file.rb
cucumber-3.0.0.pre.2 lib/cucumber/cli/rerun_file.rb
cucumber-3.0.0.pre.1 lib/cucumber/cli/rerun_file.rb