Class: Gitrb::Blob
Overview
This class stores the raw string data of a blob
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#mode ⇒ Object
Returns the value of attribute mode.
Attributes inherited from GitObject
Instance Method Summary collapse
- #dump ⇒ Object
-
#id=(id) ⇒ Object
Set new repository (modified flag is reset).
-
#initialize(options = {}) ⇒ Blob
constructor
Initialize a Blob.
- #modified? ⇒ Boolean
-
#save ⇒ Object
Save the data to the git object repository.
- #type ⇒ Object
Methods inherited from GitObject
#==, factory, #git_object, inherited
Constructor Details
#initialize(options = {}) ⇒ Blob
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
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/gitrb/blob.rb', line 6 def data @data end |
#mode ⇒ Object
Returns the value of attribute mode.
6 7 8 |
# File 'lib/gitrb/blob.rb', line 6 def mode @mode end |
Instance Method Details
#dump ⇒ Object
46 47 48 |
# File 'lib/gitrb/blob.rb', line 46 def dump @data end |
#id=(id) ⇒ Object
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 |
#modified? ⇒ Boolean
16 17 18 |
# File 'lib/gitrb/blob.rb', line 16 def modified? @modified end |
#save ⇒ Object
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 |
#type ⇒ Object
42 43 44 |
# File 'lib/gitrb/blob.rb', line 42 def type :blob end |