module Sub
Private Instance Methods
match_array?(expected, actual)
click to toggle source
# File lib/match_hash/sub/match_hash.rb, line 24 def match_array?(expected, actual) expected.each_with_index do |data,i| case data when Hash match_hash(data, actual[i]) when Array match_array(data, actual[i]) else match_value(data, actual[i]) end end end
Also aliased as: match_array
match_hash?(expected, actual)
click to toggle source
# File lib/match_hash/sub/match_hash.rb, line 7 def match_hash?(expected, actual) expected.each do |key, value| return true unless actual.has_key?(key) @is_errors << match_value(expected[key], actual[key]) return true if @is_errors.include?(true) end return true if @is_errors.include?(true) actual.each do |key, value| return true unless expected.has_key?(key) @is_errors << match_value(expected[key], actual[key]) return true if @is_errors.include?(true) end @is_errors.include?(true) end
Also aliased as: match_hash
match_value?(expected, actual)
click to toggle source
trueを返すときがエラー
# File lib/match_hash/sub/match_hash.rb, line 39 def match_value?(expected, actual) match_hash(expected, actual) if expected.is_a?(Hash) match_array(expected, actual) if expected.is_a?(Array) return false if expected == actual return true end
Also aliased as: match_value