Class: MismatchInspectable::ArrayFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Formatter

#merge_mismatches

Constructor Details

#initializeArrayFormatter

Returns a new instance of ArrayFormatter.



7
8
9
10
# File 'lib/mismatch_inspectable/formatter/array_formatter.rb', line 7

def initialize
  super
  @mismatches = []
end

Instance Attribute Details

#mismatchesObject (readonly)

Returns the value of attribute mismatches.



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

def mismatches
  @mismatches
end

Instance Method Details

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



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

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

#process_mismatches(nested_mismatches) ⇒ Object



16
17
18
# File 'lib/mismatch_inspectable/formatter/array_formatter.rb', line 16

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