Class: GitDB::Objects::Entry

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

Instance Attribute Summary collapse

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

#inspect, #raw

Constructor Details

#initialize(sha, permissions, name) ⇒ Entry

Returns a new instance of Entry.



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

def initialize(sha, permissions, name)
  @sha = sha
  @permissions = permissions
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



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

def permissions
  @permissions
end

#shaObject (readonly)

Returns the value of attribute sha.



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

def sha
  @sha
end

Instance Method Details

#propertiesObject



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

def properties
  [:permissions, :name]
end

#to_hashObject



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

def to_hash
  { :sha => sha, :permissions => permissions, :name => name }
end

#to_jsonObject



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

def to_json
  to_hash.to_json
end