Class: GitStore::Blob
- Inherits:
-
Object
- Object
- GitStore::Blob
- Defined in:
- lib/git_store/blob.rb
Overview
This class stores the raw string data of a blob, but also the deserialized data object.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#id ⇒ Object
Returns the value of attribute id.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#object ⇒ Object
Returns the value of attribute object.
-
#store ⇒ Object
Returns the value of attribute store.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #dump ⇒ Object
-
#initialize(store, id = nil, data = nil) ⇒ Blob
constructor
Initialize a Blob.
-
#write ⇒ Object
Write the data to the git object store.
Constructor Details
#initialize(store, id = nil, data = nil) ⇒ Blob
Initialize a Blob
10 11 12 13 14 15 |
# File 'lib/git_store/blob.rb', line 10 def initialize(store, id = nil, data = nil) @store = store @id = id || store.id_for('blob', data) @data = data @mode = "100644" end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/git_store/blob.rb', line 7 def data @data end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/git_store/blob.rb', line 7 def id @id end |
#mode ⇒ Object
Returns the value of attribute mode.
7 8 9 |
# File 'lib/git_store/blob.rb', line 7 def mode @mode end |
#object ⇒ Object
Returns the value of attribute object.
7 8 9 |
# File 'lib/git_store/blob.rb', line 7 def object @object end |
#store ⇒ Object
Returns the value of attribute store.
7 8 9 |
# File 'lib/git_store/blob.rb', line 7 def store @store end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 |
# File 'lib/git_store/blob.rb', line 17 def ==(other) Blob === other and id == other.id end |
#dump ⇒ Object
21 22 23 |
# File 'lib/git_store/blob.rb', line 21 def dump @data end |
#write ⇒ Object
Write the data to the git object store
26 27 28 |
# File 'lib/git_store/blob.rb', line 26 def write @id = store.put(self) end |