Class: Gitlab::Git::Blob
- Inherits:
-
Object
- Object
- Gitlab::Git::Blob
- Includes:
- Linguist::BlobHelper
- Defined in:
- lib/gitlab_git/blob.rb
Instance Attribute Summary collapse
-
#raw_blob ⇒ Object
Returns the value of attribute raw_blob.
Instance Method Summary collapse
- #data ⇒ Object
- #empty? ⇒ Boolean
- #exists? ⇒ Boolean
-
#initialize(repository, sha, ref, path) ⇒ Blob
constructor
A new instance of Blob.
- #mode ⇒ Object
- #name ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(repository, sha, ref, path) ⇒ Blob
Returns a new instance of Blob.
8 9 10 11 12 13 |
# File 'lib/gitlab_git/blob.rb', line 8 def initialize(repository, sha, ref, path) @repository, @sha, @ref = repository, sha, ref @commit = @repository.commit(sha) @raw_blob = @repository.tree(@commit, path) end |
Instance Attribute Details
#raw_blob ⇒ Object
Returns the value of attribute raw_blob.
6 7 8 |
# File 'lib/gitlab_git/blob.rb', line 6 def raw_blob @raw_blob end |
Instance Method Details
#data ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/gitlab_git/blob.rb', line 15 def data if raw_blob and raw_blob.respond_to?('data') raw_blob.data else nil end end |
#empty? ⇒ Boolean
31 32 33 |
# File 'lib/gitlab_git/blob.rb', line 31 def empty? !data || data == '' end |
#exists? ⇒ Boolean
27 28 29 |
# File 'lib/gitlab_git/blob.rb', line 27 def exists? raw_blob end |
#mode ⇒ Object
35 36 37 |
# File 'lib/gitlab_git/blob.rb', line 35 def mode raw_blob.mode end |
#name ⇒ Object
23 24 25 |
# File 'lib/gitlab_git/blob.rb', line 23 def name raw_blob.name end |
#size ⇒ Object
39 40 41 |
# File 'lib/gitlab_git/blob.rb', line 39 def size raw_blob.size end |