enum
Athena::Routing::Generator::ReferenceType
Overview
Represents the type of URLs that are able to be generated via an ART::Generator::Interface.
Defined in:
generator/reference_type.crEnum Members
-
ABSOLUTE_URL =
0 -
Includes an absolute URL including protocol, hostname, and path:
https://api.example.com/add/10/5. -
ABSOLUTE_PATH =
1 -
The default type, includes an absolute path from the root to the generated route:
/add/10/5. -
RELATIVE_PATH =
2 -
Returns a path relative to the path of the request. For example:
routes = ART::RouteCollection.new routes.add "one", ART::Route.new "/a/b/c/d" routes.add "two", ART::Route.new "/a/b/c/" routes.add "three", ART::Route.new "/a/b/" routes.add "four", ART::Route.new "/a/b/c/other" routes.add "five", ART::Route.new "/a/x/y" ART.compile routes context = ART::RequestContext.new path: "/a/b/c/d" generator = ART::Generator::URLGenerator.new context generator.generate "one", reference_type: :relative_path # => "" generator.generate "two", reference_type: :relative_path # => "./" generator.generate "three", reference_type: :relative_path # => "../" generator.generate "four", reference_type: :relative_path # => "other" generator.generate "five", reference_type: :relative_path # => "../../x/y" -
NETWORK_PATH =
3 -
Similar to
ABSOLUTE_URL, but reuses the current protocol://api.example.com/add/10/5.
Instance Method Summary
-
#absolute_path?
Returns
trueif this enum value equalsABSOLUTE_PATH -
#absolute_url?
Returns
trueif this enum value equalsABSOLUTE_URL -
#network_path?
Returns
trueif this enum value equalsNETWORK_PATH -
#relative_path?
Returns
trueif this enum value equalsRELATIVE_PATH