Sha256: a08b02d39655e041ec67d14df74dbbbfdef762d8ce0c946772e8bd87b81eb4d8
Contents?: true
Size: 790 Bytes
Versions: 6
Compression:
Stored size: 790 Bytes
Contents
require 'parameters/types/object' require 'uri' module Parameters module Types class URI < Object # # Determines if the value is already a URI. # # @param [Object] value # The value to inspect. # # @return [Boolean] # Specifies whether the value inherits `URI::Generic`. # def self.===(value) value.kind_of?(::URI::Generic) end # # Coerces a value into a URI. # # @param [#to_uri, #to_s] value # The value to coerce. # # @return [URI::Generic] # The coerced URI. # def self.coerce(value) if value.respond_to?(:to_uri) value.to_uri else ::URI.parse(value.to_s) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems