Class: Grape::Namespace

Inherits:
Object
  • Object
show all
Defined in:
lib/grape/namespace.rb

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Namespace) initialize(space, options = {})

options: requirements: a hash



7
8
9
# File 'lib/grape/namespace.rb', line 7

def initialize(space, options = {})
  @space, @options = space.to_s, options
end

Instance Attribute Details

- (Object) options (readonly)

Returns the value of attribute options



3
4
5
# File 'lib/grape/namespace.rb', line 3

def options
  @options
end

- (Object) space (readonly)

Returns the value of attribute space



3
4
5
# File 'lib/grape/namespace.rb', line 3

def space
  @space
end

Class Method Details

+ (Object) joined_space(settings)



15
16
17
# File 'lib/grape/namespace.rb', line 15

def self.joined_space(settings)
  settings.gather(:namespace).map(&:space).join("/")
end

+ (Object) joined_space_path(settings)



19
20
21
# File 'lib/grape/namespace.rb', line 19

def self.joined_space_path(settings)
  Rack::Mount::Utils.normalize_path(joined_space(settings))
end

Instance Method Details

- (Object) requirements



11
12
13
# File 'lib/grape/namespace.rb', line 11

def requirements
  options[:requirements] || {}
end