Class: RailVerdict::Git::ChangedFile

Inherits:
Object
  • Object
show all
Defined in:
lib/rail_verdict/git/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, path:, old_path:, new_path:, score:, binary: false, lines_added: nil, lines_removed: nil) ⇒ ChangedFile

Returns a new instance of ChangedFile.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rail_verdict/git/context.rb', line 12

def initialize(status:, path:, old_path:, new_path:, score:, binary: false, lines_added: nil, lines_removed: nil)
  @status = status
  @path = path
  @old_path = old_path
  @new_path = new_path
  @score = score
  @binary = binary
  @lines_added = lines_added
  @lines_removed = lines_removed
  freeze
end

Instance Attribute Details

#binaryObject

Returns the value of attribute binary.



10
11
12
# File 'lib/rail_verdict/git/context.rb', line 10

def binary
  @binary
end

#lines_addedObject (readonly)

Returns the value of attribute lines_added.



9
10
11
# File 'lib/rail_verdict/git/context.rb', line 9

def lines_added
  @lines_added
end

#lines_removedObject (readonly)

Returns the value of attribute lines_removed.



9
10
11
# File 'lib/rail_verdict/git/context.rb', line 9

def lines_removed
  @lines_removed
end

#new_pathObject (readonly)

Returns the value of attribute new_path.



9
10
11
# File 'lib/rail_verdict/git/context.rb', line 9

def new_path
  @new_path
end

#old_pathObject (readonly)

Returns the value of attribute old_path.



9
10
11
# File 'lib/rail_verdict/git/context.rb', line 9

def old_path
  @old_path
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/rail_verdict/git/context.rb', line 9

def path
  @path
end

#scoreObject (readonly)

Returns the value of attribute score.



9
10
11
# File 'lib/rail_verdict/git/context.rb', line 9

def score
  @score
end

#statusObject (readonly)

Returns the value of attribute status.



9
10
11
# File 'lib/rail_verdict/git/context.rb', line 9

def status
  @status
end

Instance Method Details

#to_hObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rail_verdict/git/context.rb', line 24

def to_h
  {
    "status" => status.to_s,
    "path" => path,
    "old_path" => old_path,
    "new_path" => new_path,
    "score" => score,
    "binary" => binary,
    "lines_added" => lines_added,
    "lines_removed" => lines_removed
  }
end