Class: GitDump::Entry
- Inherits:
-
PathObject
- Object
- PathObject
- GitDump::Entry
- Defined in:
- lib/git_dump/entry.rb
Overview
Entry at path
Instance Attribute Summary collapse
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
Attributes inherited from PathObject
Instance Method Summary collapse
-
#initialize(repo, dir, name, sha, mode) ⇒ Entry
constructor
A new instance of Entry.
- #inspect ⇒ Object
-
#open(&block) ⇒ Object
Pipe for reading data.
-
#read ⇒ Object
Data.
-
#write_to(path) ⇒ Object
Write to path.
Constructor Details
#initialize(repo, dir, name, sha, mode) ⇒ Entry
Returns a new instance of Entry.
7 8 9 10 |
# File 'lib/git_dump/entry.rb', line 7 def initialize(repo, dir, name, sha, mode) super(repo, dir, name) @sha, @mode = sha, (mode & 0100) == 0 ? 0644 : 0755 end |
Instance Attribute Details
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
6 7 8 |
# File 'lib/git_dump/entry.rb', line 6 def mode @mode end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
6 7 8 |
# File 'lib/git_dump/entry.rb', line 6 def sha @sha end |
Instance Method Details
#inspect ⇒ Object
27 28 29 |
# File 'lib/git_dump/entry.rb', line 27 def inspect "#<#{self.class} sha=#{@sha} mode=#{format '%03o', @mode}>" end |
#open(&block) ⇒ Object
Pipe for reading data
13 14 15 |
# File 'lib/git_dump/entry.rb', line 13 def open(&block) repo.blob_pipe(sha, &block) end |
#read ⇒ Object
Data
18 19 20 |
# File 'lib/git_dump/entry.rb', line 18 def read repo.blob_read(sha) end |
#write_to(path) ⇒ Object
Write to path
23 24 25 |
# File 'lib/git_dump/entry.rb', line 23 def write_to(path) repo.blob_unpack(sha, path, mode) end |