Class: SimpleRouter::Engines::SimpleEngine::Pattern

Inherits:
Path
  • Object
show all
Defined in:
lib/simple_router/engines/simple_engine.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Path

#ext, #parts

Instance Method Summary collapse

Methods inherited from Path

#initialize, #to_s

Constructor Details

This class inherits a constructor from SimpleRouter::Engines::SimpleEngine::Path

Instance Method Details

#==(path) ⇒ Object



78
79
80
81
82
# File 'lib/simple_router/engines/simple_engine.rb', line 78

def ==(path)
  is_match = size_match?(path) && ext_match?(path) && static_match?(path)
  @match = path if is_match
  is_match
end

#variablesObject Also known as: vars



66
67
68
69
70
71
72
73
74
75
# File 'lib/simple_router/engines/simple_engine.rb', line 66

def variables
  return [] unless @match

  a = []
  self.parts.each_with_index do |part,i|
    a << @match.parts[i] if part[0] == ?:
  end
  a << @match.ext[1..-1] if self.ext[1] == ?:
  a
end