Class: GitDB::Objects::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/git-db/objects/base.rb

Direct Known Subclasses

Blob, Commit, Entry, Tag, Tree

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Base

Returns a new instance of Base.



5
6
7
# File 'lib/git-db/objects/base.rb', line 5

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/git-db/objects/base.rb', line 3

def data
  @data
end

Instance Method Details

#inspectObject



9
10
11
# File 'lib/git-db/objects/base.rb', line 9

def inspect
  %{#<#{self.class} #{inspect_properties}>}
end

#propertiesObject



13
14
15
# File 'lib/git-db/objects/base.rb', line 13

def properties
  [:data]
end

#rawObject



17
18
19
# File 'lib/git-db/objects/base.rb', line 17

def raw
  data
end

#shaObject



21
22
23
# File 'lib/git-db/objects/base.rb', line 21

def sha
  Digest::SHA1.hexdigest(raw)
end