Class: CheckPlease::Diff

Inherits:
Object
  • Object
show all
Defined in:
lib/check_please/diff.rb

Constant Summary collapse

COLUMNS =
%i[ type path reference candidate ]

Instance Method Summary collapse

Constructor Details

#initialize(type, path, reference, candidate) ⇒ Diff

Returns a new instance of Diff.



7
8
9
10
11
12
# File 'lib/check_please/diff.rb', line 7

def initialize(type, path, reference, candidate)
  @type      = type
  @path      = path.to_s
  @reference = reference
  @candidate = candidate
end

Instance Method Details

#attributesObject



14
15
16
# File 'lib/check_please/diff.rb', line 14

def attributes
  Hash[ COLUMNS.map { |name| [ name, send(name) ] } ]
end

#inspectObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/check_please/diff.rb', line 18

def inspect
  s = "<"
  s << self.class.name
  s << " type=#{type}"
  s << " path=#{path}"
  s << " ref=#{reference.inspect}"
  s << " can=#{candidate.inspect}"
  s << ">"
  s
end