class Proximity::Router::Match

Public Class Methods

new(matches) click to toggle source
# File lib/proximity/router.rb, line 24
def initialize(matches)
  @matches = matches
  @match   = matches.first
end

Public Instance Methods

matches() click to toggle source
# File lib/proximity/router.rb, line 29
def matches
  @match[1]
end
presence() click to toggle source
# File lib/proximity/router.rb, line 43
def presence
  @matches.empty? ? nil : self
end
proxy() click to toggle source
# File lib/proximity/router.rb, line 39
def proxy
  @match[2].proxy
end
target() click to toggle source
# File lib/proximity/router.rb, line 33
def target
  matches.inject(proxy.target) { |target, (key, value)|
    target.gsub(":#{key}", value)
  }
end