Class: Grape::Router::Pattern

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/grape/router/pattern.rb

Defined Under Namespace

Classes: PatternCache

Constant Summary collapse

DEFAULT_PATTERN_OPTIONS =
{ uri_decode: true }.freeze
DEFAULT_SUPPORTED_CAPTURE =
%i[format version].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern, **options) ⇒ Pattern

Returns a new instance of Pattern.


20
21
22
23
24
25
# File 'lib/grape/router/pattern.rb', line 20

def initialize(pattern, **options)
  @origin  = pattern
  @path    = build_path(pattern, **options)
  @pattern = Mustermann::Grape.new(@path, **pattern_options(options))
  @to_regexp = @pattern.to_regexp
end

Instance Attribute Details

#originObject (readonly)

Returns the value of attribute origin


13
14
15
# File 'lib/grape/router/pattern.rb', line 13

def origin
  @origin
end

#pathObject (readonly)

Returns the value of attribute path


13
14
15
# File 'lib/grape/router/pattern.rb', line 13

def path
  @path
end

#patternObject (readonly)

Returns the value of attribute pattern


13
14
15
# File 'lib/grape/router/pattern.rb', line 13

def pattern
  @pattern
end

#to_regexpObject (readonly)

Returns the value of attribute to_regexp


13
14
15
# File 'lib/grape/router/pattern.rb', line 13

def to_regexp
  @to_regexp
end