Class: MismatchInspectable::ArrayFormatter
- Inherits:
-
Object
- Object
- MismatchInspectable::ArrayFormatter
- Defined in:
- lib/mismatch_inspectable/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.
- #merge_mismatches(nested_mismatches) ⇒ Object
Constructor Details
#initialize ⇒ ArrayFormatter
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
#mismatches ⇒ Object (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 |