Sha256: 1359ecb6a6dd278997eeaa0c65446e49b90cbe5eedfbc8cd6484852131485d03

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

module GitlabQuality
  module TestTooling
    module GitlabClient
      class RepositoryFilesClient < GitlabClient
        attr_reader :file_path, :ref

        def initialize(file_path:, ref:, **kwargs)
          @file_path = file_path
          @ref = ref
          super(**kwargs)
        end

        def file_contents
          handle_gitlab_client_exceptions do
            client.file_contents(project, file_path.gsub(%r{^/}, ""), ref)
          end
        end

        def file_contents_at_line(line_number)
          file_contents.lines(chomp: true)[line_number - 1]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitlab_quality-test_tooling-1.29.1 lib/gitlab_quality/test_tooling/gitlab_client/repository_files_client.rb