Class: Grape::Path

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(raw_path, raw_namespace, settings) ⇒ Path

Returns a new instance of Path.

[View source] [View on GitHub]

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

#originObject (readonly)

Returns the value of attribute origin.

[View on GitHub]

10
11
12
# File 'lib/grape/path.rb', line 10

def origin
  @origin
end

#suffixObject (readonly)

Returns the value of attribute suffix.

[View on GitHub]

10
11
12
# File 'lib/grape/path.rb', line 10

def suffix
  @suffix
end

Instance Method Details

#to_sObject

[View source] [View on GitHub]

17
18
19
# File 'lib/grape/path.rb', line 17

def to_s
  "#{origin}#{suffix}"
end