Class: MismatchInspectable::ArrayFormatter
- Defined in:
- lib/mismatch_inspectable/formatter/array_formatter.rb
Instance Attribute Summary collapse
-
#mismatches ⇒ Object
readonly
Returns the value of attribute mismatches.
Instance Method Summary collapse
- #add_mismatch(prefix, attribute, curr_val, other_val) ⇒ Object
-
#initialize ⇒ ArrayFormatter
constructor
A new instance of ArrayFormatter.
- #process_mismatches(nested_mismatches) ⇒ Object
Methods inherited from Formatter
Constructor Details
#initialize ⇒ ArrayFormatter
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
#mismatches ⇒ Object (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 |