Class: Angus::Router::Route

Inherits:
Struct
  • Object
show all
Defined in:
lib/angus/router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of method



30
31
32
# File 'lib/angus/router.rb', line 30

def method
  @method
end

#path_patternObject

Returns the value of attribute path_pattern

Returns:

  • (Object)

    the current value of path_pattern



30
31
32
# File 'lib/angus/router.rb', line 30

def path_pattern
  @path_pattern
end

#procObject

Returns the value of attribute proc

Returns:

  • (Object)

    the current value of proc



30
31
32
# File 'lib/angus/router.rb', line 30

def proc
  @proc
end

Instance Method Details

#match(path) ⇒ MatchData?

Matches the given path against #path_pattern.

Returns:

  • (MatchData)

    when match succeeds

  • (nil)

    when match fails



50
51
52
# File 'lib/angus/router.rb', line 50

def match(path)
  path_pattern.match(path)
end

#param_namesArray<String>

Returns the parameter names for this route.

Returns:

  • (Array<String>)


35
36
37
# File 'lib/angus/router.rb', line 35

def param_names
  path_pattern.param_names
end

#params?Boolean

Returns the true if the current route contains defined params.

Returns:

  • (Boolean)


42
43
44
# File 'lib/angus/router.rb', line 42

def params?
  param_names.any?
end