Class: Grit::GitRuby::Internal::RawObject
- Inherits:
-
Object
- Object
- Grit::GitRuby::Internal::RawObject
- Defined in:
- lib/grit/git-ruby/internal/raw_object.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, content) ⇒ RawObject
constructor
A new instance of RawObject.
- #sha1 ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(type, content) ⇒ RawObject
Returns a new instance of RawObject.
26 27 28 29 |
# File 'lib/grit/git-ruby/internal/raw_object.rb', line 26 def initialize(type, content) @type = type @content = content end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
25 26 27 |
# File 'lib/grit/git-ruby/internal/raw_object.rb', line 25 def content @content end |
#type ⇒ Object
Returns the value of attribute type.
25 26 27 |
# File 'lib/grit/git-ruby/internal/raw_object.rb', line 25 def type @type end |
Instance Method Details
#sha1 ⇒ Object
31 32 33 |
# File 'lib/grit/git-ruby/internal/raw_object.rb', line 31 def sha1 Digest::SHA1.digest("%s %d\0" % [@type, @content.length] + @content) end |
#to_hash ⇒ Object
35 36 37 38 39 40 |
# File 'lib/grit/git-ruby/internal/raw_object.rb', line 35 def to_hash { :type => @type, :content => @content } end |