Class: Blastr::SourceControl::GitRevision
- Inherits:
-
Object
- Object
- Blastr::SourceControl::GitRevision
- Defined in:
- lib/scm/git.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #before?(revision) ⇒ Boolean
-
#initialize(name, date) ⇒ GitRevision
constructor
A new instance of GitRevision.
- #to_s ⇒ Object
Constructor Details
#initialize(name, date) ⇒ GitRevision
Returns a new instance of GitRevision.
18 19 20 21 22 |
# File 'lib/scm/git.rb', line 18 def initialize(name, date) @name = name @date = date raise ArgumentError if date.nil? and name != "HEAD" end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
16 17 18 |
# File 'lib/scm/git.rb', line 16 def date @date end |
#name ⇒ Object
Returns the value of attribute name.
16 17 18 |
# File 'lib/scm/git.rb', line 16 def name @name end |
Class Method Details
.head ⇒ Object
34 35 36 |
# File 'lib/scm/git.rb', line 34 def self.head GitRevision.new("HEAD", nil) end |
Instance Method Details
#==(other) ⇒ Object
38 39 40 41 |
# File 'lib/scm/git.rb', line 38 def ==(other) return false unless other.is_a? GitRevision other.name == @name and other.date == @date end |
#before?(revision) ⇒ Boolean
28 29 30 31 32 |
# File 'lib/scm/git.rb', line 28 def before?(revision) return false if @name == "HEAD" return true if revision.name == "HEAD" @date < revision.date end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/scm/git.rb', line 24 def to_s @name end |