Class: Grape::Router::Pattern

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

Defined Under Namespace

Classes: PatternCache

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern, **options) ⇒ Pattern

Returns a new instance of Pattern.



17
18
19
20
21
22
23
# File 'lib/grape/router/pattern.rb', line 17

def initialize(pattern, **options)
  @origin = pattern
  @path = build_path(pattern, anchor: options[:anchor], suffix: options[:suffix])
  @pattern = build_pattern(@path, options)
  @to_regexp = @pattern.to_regexp
  @captures_default = regex_captures_default(@to_regexp)
end

Instance Attribute Details

#captures_defaultObject (readonly)

Returns the value of attribute captures_default.



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

def captures_default
  @captures_default
end

#originObject (readonly)

Returns the value of attribute origin.



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

def origin
  @origin
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

#patternObject (readonly)

Returns the value of attribute pattern.



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

def pattern
  @pattern
end

#to_regexpObject (readonly)

Returns the value of attribute to_regexp.



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

def to_regexp
  @to_regexp
end