Class: MismatchInspectable::ArrayFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/mismatch_inspectable/array_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeArrayFormatter

Returns a new instance of ArrayFormatter.



5
6
7
# File 'lib/mismatch_inspectable/array_formatter.rb', line 5

def initialize
  @mismatches = []
end

Instance Attribute Details

#mismatchesObject (readonly)

Returns the value of attribute mismatches.



3
4
5
# File 'lib/mismatch_inspectable/array_formatter.rb', line 3

def mismatches
  @mismatches
end

Instance Method Details

#add_mismatch(prefix, attribute, curr_val, other_val) ⇒ Object



9
10
11
# File 'lib/mismatch_inspectable/array_formatter.rb', line 9

def add_mismatch(prefix, attribute, curr_val, other_val)
  @mismatches << [prefix + attribute.to_s, curr_val, other_val]
end

#merge_mismatches(nested_mismatches) ⇒ Object



13
14
15
# File 'lib/mismatch_inspectable/array_formatter.rb', line 13

def merge_mismatches(nested_mismatches)
  @mismatches.concat(nested_mismatches)
end