Class: Mayu::Routing::Routes::Param

Inherits:
Route
  • Object
show all
Defined in:
lib/mayu/routing/routes.rb

Instance Attribute Summary collapse

Attributes inherited from Route

#layout, #not_found, #page

Instance Method Summary collapse

Methods inherited from Route

#add_route, #match

Constructor Details

#initialize(name, format: /\A\d+\z/) ⇒ Param

Returns a new instance of Param.



72
73
74
75
76
# File 'lib/mayu/routing/routes.rb', line 72

def initialize(name, format: /\A\d+\z/)
  super()
  @name = name
  @format = format
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



69
70
71
# File 'lib/mayu/routing/routes.rb', line 69

def format
  @format
end

#nameObject (readonly)

Returns the value of attribute name.



67
68
69
# File 'lib/mayu/routing/routes.rb', line 67

def name
  @name
end

Instance Method Details

#match?(part) ⇒ Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/mayu/routing/routes.rb', line 79

def match?(part)
  @format.match?(part)
end