Class: Hanami::Router::Prefix Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/router/prefix.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

URL Path prefix

Since:

  • 2.0.0

Instance Method Summary collapse

Constructor Details

#initialize(prefix) ⇒ Prefix

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Prefix.

Since:

  • 2.0.0



12
13
14
# File 'lib/hanami/router/prefix.rb', line 12

def initialize(prefix)
  @prefix = prefix
end

Instance Method Details

#join(path) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



18
19
20
21
22
# File 'lib/hanami/router/prefix.rb', line 18

def join(path)
  self.class.new(
    _join(path)
  )
end

#relative_join(path, separator = DEFAULT_SEPARATOR) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



26
27
28
29
# File 'lib/hanami/router/prefix.rb', line 26

def relative_join(path, separator = DEFAULT_SEPARATOR)
  _join(path.to_s)
    .gsub(DEFAULT_SEPARATOR_REGEXP, separator)[1..]
end

#to_sObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



33
34
35
# File 'lib/hanami/router/prefix.rb', line 33

def to_s
  @prefix
end

#to_symObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



39
40
41
# File 'lib/hanami/router/prefix.rb', line 39

def to_sym
  @prefix.to_sym
end