Class: Gitlab::Git::LfsPointerFile
- Inherits:
-
Object
- Object
- Gitlab::Git::LfsPointerFile
- Defined in:
- lib/gitlab/git/lfs_pointer_file.rb
Constant Summary collapse
- VERSION =
"https://git-lfs.github.com/spec/v1"
- VERSION_LINE =
"version #{VERSION}"
Instance Method Summary collapse
-
#initialize(data) ⇒ LfsPointerFile
constructor
A new instance of LfsPointerFile.
- #inspect ⇒ Object
- #pointer ⇒ Object
- #sha256 ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(data) ⇒ LfsPointerFile
Returns a new instance of LfsPointerFile.
9 10 11 |
# File 'lib/gitlab/git/lfs_pointer_file.rb', line 9 def initialize(data) @data = data end |
Instance Method Details
#inspect ⇒ Object
29 30 31 |
# File 'lib/gitlab/git/lfs_pointer_file.rb', line 29 def inspect "#<#{self.class}:#{object_id} @size=#{size}, @sha256=#{sha256.inspect}>" end |
#pointer ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/gitlab/git/lfs_pointer_file.rb', line 13 def pointer @pointer ||= <<~FILE #{VERSION_LINE} oid sha256:#{sha256} size #{size} FILE end |
#sha256 ⇒ Object
25 26 27 |
# File 'lib/gitlab/git/lfs_pointer_file.rb', line 25 def sha256 @sha256 ||= Digest::SHA256.hexdigest(@data) end |
#size ⇒ Object
21 22 23 |
# File 'lib/gitlab/git/lfs_pointer_file.rb', line 21 def size @size ||= @data.bytesize end |