Class: Gitrb::Blob
Overview
This class stores the raw string data of a blob
Instance Attribute Summary (collapse)
-
- (Object) data
Returns the value of attribute data.
-
- (Object) mode
Returns the value of attribute mode.
Attributes inherited from GitObject
Instance Method Summary (collapse)
- - (Object) dump
-
- (Object) id=(id)
Set new repository (modified flag is reset).
-
- (Blob) initialize(options = {})
constructor
Initialize a Blob.
- - (Boolean) modified?
-
- (Object) save
Save the data to the git object repository.
- - (Object) type
Methods inherited from GitObject
#==, factory, #git_object, inherited
Constructor Details
- (Blob) initialize(options = {})
Initialize a Blob
9 10 11 12 13 14 |
# File 'lib/gitrb/blob.rb', line 9 def initialize( = {}) super() @data = [:data] @mode = [:mode] || 0100644 @modified = true if !id end |
Instance Attribute Details
- (Object) data
Returns the value of attribute data
6 7 8 |
# File 'lib/gitrb/blob.rb', line 6 def data @data end |
- (Object) mode
Returns the value of attribute mode
6 7 8 |
# File 'lib/gitrb/blob.rb', line 6 def mode @mode end |
Instance Method Details
- (Object) dump
46 47 48 |
# File 'lib/gitrb/blob.rb', line 46 def dump @data end |
- (Object) id=(id)
Set new repository (modified flag is reset)
37 38 39 40 |
# File 'lib/gitrb/blob.rb', line 37 def id=(id) @modified = false super end |
- (Boolean) modified?
16 17 18 |
# File 'lib/gitrb/blob.rb', line 16 def modified? @modified end |
- (Object) save
Save the data to the git object repository
51 52 53 54 55 |
# File 'lib/gitrb/blob.rb', line 51 def save raise 'Blob is empty' if !data repository.put(self) if modified? id end |
- (Object) type
42 43 44 |
# File 'lib/gitrb/blob.rb', line 42 def type :blob end |