Sha256: aec91fb02fd81b5ad167d19416612071c8ee6166d08cab11d6ea958a8350eb5e

Contents?: true

Size: 653 Bytes

Versions: 2

Compression:

Stored size: 653 Bytes

Contents

require 'linguist'
require 'elasticsearch/git/encoder_helper'

module Elasticsearch
  module Git
    class LiteBlob
      include Linguist::BlobHelper
      include Elasticsearch::Git::EncoderHelper

      attr_accessor :id, :name, :path, :size, :mode, :commit_id
      attr_writer :data

      def initialize(repo, raw_blob_hash)
        @id   = raw_blob_hash[:oid]
        @blob  = repo.lookup(@id)

        @mode = raw_blob_hash[:mode].to_s(8)
        @size = @blob.size
        @path = encode!(raw_blob_hash[:path])
        @name = @path.split('/').last
      end

      def data
        @data ||= encode!(@blob.content)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gitlab-elasticsearch-git-1.2.0 lib/elasticsearch/git/lite_blob.rb
gitlab-elasticsearch-git-1.1.1 lib/elasticsearch/git/lite_blob.rb