Class: Amp::Core::Repositories::Git::RawObject
- Inherits:
-
Object
- Object
- Amp::Core::Repositories::Git::RawObject
- Defined in:
- lib/amp-git/repo_format/raw_object.rb
Overview
LooseObject
A single loose object (tree, tag, commit, etc.) in the Git system. Its type and content will be determined after we read the file.
It is uniquely identified by a SHA1 hash.
Direct Known Subclasses
Constant Summary collapse
- AUTHOR_MATCH =
/([^<]*) <(.*)> (\d+) ([-+]?\d+)/
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#hash_id ⇒ Object
readonly
Returns the value of attribute hash_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
33 34 35 |
# File 'lib/amp-git/repo_format/raw_object.rb', line 33 def content @content end |
#hash_id ⇒ Object (readonly)
Returns the value of attribute hash_id.
33 34 35 |
# File 'lib/amp-git/repo_format/raw_object.rb', line 33 def hash_id @hash_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
33 34 35 |
# File 'lib/amp-git/repo_format/raw_object.rb', line 33 def type @type end |
Class Method Details
.construct(hsh, opener, type, content) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/amp-git/repo_format/raw_object.rb', line 43 def construct(hsh, opener, type, content) # type, content should both be set now type_lookup = {'tree' => TreeObject, 'commit' => CommitObject, 'tag' => TagObject} object_klass = type_lookup[type] || LooseObject result = object_klass.new(hsh, opener, content) result.type = type if object_klass == LooseObject result end |
.for_hash(hsh, git_opener) ⇒ Object
38 39 40 41 |
# File 'lib/amp-git/repo_format/raw_object.rb', line 38 def for_hash(hsh, git_opener) # no way to handle packed objects yet LooseObject.lookup(hsh, git_opener) end |