Sha256: 31f5da94e6f1b14b304140ea9b2fde6dadee16a394c51bae4b4b4a5f46dc5fc0
Contents?: true
Size: 680 Bytes
Versions: 1
Compression:
Stored size: 680 Bytes
Contents
module WildcardMatchers module Matchers def is_uri(hash = {}) IsUri.new(hash) end class IsUri < ::WildcardMatchers::WildcardMatcher protected def wildcard_match(actual) uri = nil begin require "addressable/uri" uri = ::Addressable::URI.parse(actual) # if actual is ::URI re-parse rescue LoadError require "uri".tapp uri = actual.is_a?(::URI) ? actual : ::URI.parse(actual) end expectation.each do |key, value| errors.push(*self.class.superclass.check_errors(uri.__send__(key), value, position + "[#{key.inspect}]")) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wildcard_matchers-0.1.2 | lib/wildcard_matchers/matchers/is_uri.rb |