Class: MVCLI::Router::Pattern::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/mvcli/router/pattern.rb

Direct Known Subclasses

Literal, Variable

Defined Under Namespace

Classes: Literal, Variable

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Matcher

Returns a new instance of Matcher.



36
37
38
# File 'lib/mvcli/router/pattern.rb', line 36

def initialize(name)
  @name = name
end

Class Method Details

.[](segment) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/mvcli/router/pattern.rb', line 28

def self.[](segment)
  case segment
  when /^:(\w+)/ then Variable.new($1)
  else
    Literal.new(segment)
  end
end

Instance Method Details

#bind(input) ⇒ Object



40
41
42
# File 'lib/mvcli/router/pattern.rb', line 40

def bind(input)
  {}
end