Class: Obst::GitLog::Commit::FileStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/obst/git_log.rb

Overview

Constant Summary collapse

TAB =
/\t/
AMD =
/^[AMD]/
RENAME =
/^R/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ FileStatus

Returns a new instance of FileStatus.



35
36
37
38
39
40
41
42
43
44
# File 'lib/obst/git_log.rb', line 35

def initialize(line)
  if line =~ AMD
    @status, @name = line.split(TAB)
    @status = @status.downcase.to_sym
  elsif line =~ RENAME
    @score, @old_name, @name = line.split(TAB)
    @status = :r
  end
  @name.strip! if @name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



33
34
35
# File 'lib/obst/git_log.rb', line 33

def name
  @name
end

#old_nameObject (readonly)

Returns the value of attribute old_name.



33
34
35
# File 'lib/obst/git_log.rb', line 33

def old_name
  @old_name
end

#statusObject (readonly)

Returns the value of attribute status.



33
34
35
# File 'lib/obst/git_log.rb', line 33

def status
  @status
end