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

- (Entry) initialize(sha, permissions, name)

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

- (Object) name (readonly)

Returns the value of attribute name



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

def name
  @name
end

- (Object) permissions (readonly)

Returns the value of attribute permissions



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

def permissions
  @permissions
end

- (Object) sha (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

- (Object) properties



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

def properties
  [:permissions, :name]
end

- (Object) to_hash



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

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

- (Object) to_json



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

def to_json
  to_hash.to_json
end