class Ravanello::Routing::Match
Represents regex match routing rule
Attributes
regex[R]
Public Class Methods
new(regex, parent, &blk)
click to toggle source
Calls superclass method
Ravanello::Routing::Base::new
# File lib/ravanello/routing/match.rb, line 9 def initialize(regex, parent, &blk) @regex = regex super(parent, &blk) end
Public Instance Methods
routable?(path_parts)
click to toggle source
# File lib/ravanello/routing/match.rb, line 14 def routable?(path_parts) regex == '*' ? !path_parts.empty? : !path_parts.first.match(regex).nil? end
route(path_parts)
click to toggle source
# File lib/ravanello/routing/match.rb, line 18 def route(path_parts) return [] if regex == '*' path_parts[1..path_parts.length - 1] end
to_s()
click to toggle source
# File lib/ravanello/routing/match.rb, line 23 def to_s "#{parent}#{regex}#{children.empty? ? '' : ':'}" end