Class: Grit::Status::StatusFile

Inherits:
Object
  • Object
show all
Defined in:
lib/grit/lib/grit/status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base, hash) ⇒ StatusFile

Returns a new instance of StatusFile.



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/grit/lib/grit/status.rb', line 64

def initialize(base, hash)
  @base = base
  @path = hash[:path]
  @type = hash[:type]
  @stage = hash[:stage]
  @mode_index = hash[:mode_index]
  @mode_repo = hash[:mode_repo]
  @sha_index = hash[:sha_index]
  @sha_repo = hash[:sha_repo]
  @untracked = hash[:untracked]
end

Instance Attribute Details

#mode_indexObject

Returns the value of attribute mode_index.



59
60
61
# File 'lib/grit/lib/grit/status.rb', line 59

def mode_index
  @mode_index
end

#mode_repoObject

Returns the value of attribute mode_repo.



59
60
61
# File 'lib/grit/lib/grit/status.rb', line 59

def mode_repo
  @mode_repo
end

#pathObject

Returns the value of attribute path.



58
59
60
# File 'lib/grit/lib/grit/status.rb', line 58

def path
  @path
end

#sha_indexObject

Returns the value of attribute sha_index.



60
61
62
# File 'lib/grit/lib/grit/status.rb', line 60

def sha_index
  @sha_index
end

#sha_repoObject

Returns the value of attribute sha_repo.



60
61
62
# File 'lib/grit/lib/grit/status.rb', line 60

def sha_repo
  @sha_repo
end

#stageObject

Returns the value of attribute stage.



58
59
60
# File 'lib/grit/lib/grit/status.rb', line 58

def stage
  @stage
end

#typeObject

Returns the value of attribute type.



58
59
60
# File 'lib/grit/lib/grit/status.rb', line 58

def type
  @type
end

#untrackedObject

Returns the value of attribute untracked.



58
59
60
# File 'lib/grit/lib/grit/status.rb', line 58

def untracked
  @untracked
end

Instance Method Details

#blob(type = :index) ⇒ Object



76
77
78
79
80
81
82
# File 'lib/grit/lib/grit/status.rb', line 76

def blob(type = :index)
  if type == :repo
    @base.object(@sha_repo)
  else
    @base.object(@sha_index) rescue @base.object(@sha_repo)
  end
end