Module: MismatchInspectable

Defined in:
lib/mismatch_inspectable/version.rb,
lib/mismatch_inspectable/hash_formatter.rb,
lib/mismatch_inspectable/array_formatter.rb,
lib/mismatch_inspectable/mismatch_inspectable.rb

Defined Under Namespace

Modules: ClassMethods Classes: ArrayFormatter, HashFormatter, MissingCompareMethodsError

Constant Summary collapse

VERSION =
"0.1.2".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(target_class) ⇒ Object



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

def self.included(target_class)
  target_class.extend ClassMethods
end

Instance Method Details

#compare_methodsObject



33
34
35
# File 'lib/mismatch_inspectable/mismatch_inspectable.rb', line 33

def compare_methods
  self.class.compare_methods
end

#inspect_mismatch(other, recursive: false, include_class: true, prefix: "", format: :array) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/mismatch_inspectable/mismatch_inspectable.rb', line 24

def inspect_mismatch(other, recursive: false, include_class: true, prefix: "", format: :array)
  return if self.class != other.class

  formatter = select_formatter(format)

  process_attributes(formatter, other, recursive, include_class, prefix, format)
  formatter.mismatches
end