Class: Grape::Path
- Inherits:
-
Object
- Object
- Grape::Path
- Defined in:
- lib/grape/path.rb
Overview
Represents a path to an endpoint.
Defined Under Namespace
Classes: PartsCache
Constant Summary collapse
- DEFAULT_FORMAT_SEGMENT =
'(/.:format)'
- NO_VERSIONING_WITH_VALID_PATH_FORMAT_SEGMENT =
'(.:format)'
- VERSION_SEGMENT =
':version'
Instance Attribute Summary collapse
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#suffix ⇒ Object
readonly
Returns the value of attribute suffix.
Instance Method Summary collapse
-
#initialize(raw_path, raw_namespace, settings) ⇒ Path
constructor
A new instance of Path.
- #to_s ⇒ Object
Constructor Details
permalink #initialize(raw_path, raw_namespace, settings) ⇒ Path
Returns a new instance of Path.
12 13 14 15 |
# File 'lib/grape/path.rb', line 12 def initialize(raw_path, raw_namespace, settings) @origin = PartsCache[build_parts(raw_path, raw_namespace, settings)] @suffix = build_suffix(raw_path, raw_namespace, settings) end |
Instance Attribute Details
permalink #origin ⇒ Object (readonly)
Returns the value of attribute origin.
10 11 12 |
# File 'lib/grape/path.rb', line 10 def origin @origin end |
permalink #suffix ⇒ Object (readonly)
Returns the value of attribute suffix.
10 11 12 |
# File 'lib/grape/path.rb', line 10 def suffix @suffix end |
Instance Method Details
permalink #to_s ⇒ Object
[View source] [View on GitHub]
17 18 19 |
# File 'lib/grape/path.rb', line 17 def to_s "#{origin}#{suffix}" end |