Sha256: 13d17eea45f892558cb36c986676c115397688110dfd047b14862341f3e68eb9
Contents?: true
Size: 614 Bytes
Versions: 3
Compression:
Stored size: 614 Bytes
Contents
module Mirage class MockResponseSet < Hash def fuzzy_find desired_key, http_method http_method = http_method.upcase result = self[desired_key] results = find_all do |key, value| key.is_a?(Regexp) && desired_key.is_a?(String) && key.match(desired_key) && value[http_method] end.sort do |a, b| b.first.source.size <=> a.first.source.size end return result unless results && results.first return results.first[1] unless result && result[http_method] {http_method => result[http_method].concat(results.first[1][http_method])} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mirage-4.0.0.alpha10 | server/mock_response_set.rb |
mirage-4.0.0.alpha9 | server/mock_response_set.rb |
mirage-4.0.0.alpha8 | server/mock_response_set.rb |