Parent

Class/Module Index [+]

Quicksearch

Grape::Path

Attributes

namespace[R]
raw_path[R]
settings[R]

Public Class Methods

new(raw_path, namespace, settings) click to toggle source
# File lib/grape/path.rb, line 9
def initialize(raw_path, namespace, settings)
  @raw_path = raw_path
  @namespace = namespace
  @settings = settings
end
prepare(raw_path, namespace, settings) click to toggle source
# File lib/grape/path.rb, line 3
def self.prepare(raw_path, namespace, settings)
  Path.new(raw_path, namespace, settings).path_with_suffix
end

Public Instance Methods

has_namespace?() click to toggle source
# File lib/grape/path.rb, line 27
def has_namespace?
  namespace && namespace.to_s =~ /^\S/ && namespace != '/'
end
has_path?() click to toggle source
# File lib/grape/path.rb, line 31
def has_path?
  raw_path && raw_path.to_s =~ /^\S/ && raw_path != '/'
end
mount_path() click to toggle source
# File lib/grape/path.rb, line 15
def mount_path
  split_setting(:mount_path, '/')
end
path() click to toggle source
# File lib/grape/path.rb, line 43
def path
  Rack::Mount::Utils.normalize_path(parts.join('/'))
end
path_with_suffix() click to toggle source
# File lib/grape/path.rb, line 47
def path_with_suffix
  "#{path}#{suffix}"
end
root_prefix() click to toggle source
# File lib/grape/path.rb, line 19
def root_prefix
  split_setting(:root_prefix, '/')
end
suffix() click to toggle source
# File lib/grape/path.rb, line 35
def suffix
  if !uses_path_versioning? || (has_namespace? || has_path?)
    '(.:format)'
  else
    '(/.:format)'
  end
end
to_s() click to toggle source
# File lib/grape/path.rb, line 51
def to_s
  path_with_suffix
end
uses_path_versioning?() click to toggle source
# File lib/grape/path.rb, line 23
def uses_path_versioning?
  !!(settings[:version] && settings[:version_options][:using] == :path)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.