Class: Highway::Steps::Types::Url
- Defined in:
- lib/highway/steps/types/url.rb
Overview
This class represents an URL parameter type.
Instance Method Summary collapse
-
#typecheck(value) ⇒ URI?
Typecheck and coerce a value if possible.
Methods inherited from String
Methods inherited from Any
#initialize, #typecheck_and_validate, #validate
Constructor Details
This class inherits a constructor from Highway::Steps::Types::Any
Instance Method Details
#typecheck(value) ⇒ URI?
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.
25 26 27 28 29 |
# 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 |