class Highway::Steps::Types::Url

This class represents an URL parameter type.

Public Instance Methods

typecheck(value) click to toggle source

Typecheck and coerce a value if possible.

This method returns a typechecked and coerced value or `nil` if value has invalid type and can't be coerced.

@param value [Object] A value.

@return [URI, nil]

Calls superclass method Highway::Steps::Types::String#typecheck
# File lib/highway/steps/types/url.rb, line 25
def typecheck(value)
  typechecked = super(value)
  parsed = URI.parse(typechecked) rescue nil
  parsed if parsed && parsed.kind_of?(URI::HTTP)
end