class SuperDiff::ActiveSupport::OperationTreeBuilders::HashWithIndifferentAccess

Public Class Methods

applies_to?(expected, actual) click to toggle source
# File lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb, line 5
def self.applies_to?(expected, actual)
  (
    expected.is_a?(::HashWithIndifferentAccess) &&
      actual.is_a?(::Hash)
  ) ||
  (
    expected.is_a?(::Hash) &&
      actual.is_a?(::HashWithIndifferentAccess)
  )
end
new(expected:, actual:, **rest) click to toggle source
Calls superclass method
# File lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb, line 16
def initialize(expected:, actual:, **rest)
  super

  if expected.is_a?(::HashWithIndifferentAccess)
    @expected = expected.to_h
    @actual = actual.transform_keys(&:to_s)
  end

  if actual.is_a?(::HashWithIndifferentAccess)
    @expected = expected.transform_keys(&:to_s)
    @actual = actual.to_h
  end
end

Protected Instance Methods

build_operation_tree() click to toggle source
# File lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb, line 32
def build_operation_tree
  OperationTrees::HashWithIndifferentAccess.new([])
end