Class: Olelo::Version

Inherits:
Object show all
Defined in:
lib/olelo/repository.rb

Overview

Version object

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, author, date, comment, parents, head) ⇒ Version

Returns a new instance of Version.



7
8
9
# File 'lib/olelo/repository.rb', line 7

def initialize(id, author, date, comment, parents, head)
  @id, @author, @date, @comment, @parents, @head = id, author, date, comment, parents, head
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



4
5
6
# File 'lib/olelo/repository.rb', line 4

def author
  @author
end

#commentObject (readonly)

Returns the value of attribute comment.



4
5
6
# File 'lib/olelo/repository.rb', line 4

def comment
  @comment
end

#dateObject (readonly)

Returns the value of attribute date.



4
5
6
# File 'lib/olelo/repository.rb', line 4

def date
  @date
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/olelo/repository.rb', line 4

def id
  @id
end

#parentsObject (readonly)

Returns the value of attribute parents.



4
5
6
# File 'lib/olelo/repository.rb', line 4

def parents
  @parents
end

Class Method Details

.short(id) ⇒ String

Shortens given version id

Parameters:

  • long (String)

    version id

Returns:

  • (String)

    shortened version id



24
25
26
# File 'lib/olelo/repository.rb', line 24

def self.short(id)
  Repository.instance.short_version(id)
end

Instance Method Details

#==(other) ⇒ Boolean

Check equality of versions

Parameters:

Returns:

  • (Boolean)


41
42
43
# File 'lib/olelo/repository.rb', line 41

def ==(other)
  other.to_s == id
end

#shortString

Returns shortened unique version id

Returns:

  • (String)

    shortened version id



15
16
17
# File 'lib/olelo/repository.rb', line 15

def short
  Version.short(id)
end

#to_sString

Return version id

Returns:



32
33
34
# File 'lib/olelo/repository.rb', line 32

def to_s
  id
end