class Pendragon::Realism

Private Instance Methods

identity(env, route = nil) click to toggle source

@!visibility private

# File lib/pendragon/realism.rb, line 35
def identity(env, route = nil)
  with_transaction(env) do |input, method|
    route = match?(input, method)
    route.exec(env) if route
  end
end
match?(input, method) click to toggle source

@!visibility private

# File lib/pendragon/realism.rb, line 27
def match?(input, method)
  current_regexp = omap[method]
  return unless current_regexp.match(input)
  last_match = Regexp.last_match
  map[method].detect { |route| last_match["_#{route.index}"] }
end
omap() click to toggle source

@!visibility private

# File lib/pendragon/realism.rb, line 22
def omap
  @omap ||= Hash.new { |hash, key| hash[key] = // }
end
with_transaction(env) { |input, method| ... } click to toggle source

@!visibility private

# File lib/pendragon/realism.rb, line 43
def with_transaction(env)
  input, method = extract(env)
  response = yield(input, method)
  response && !(cascade = cascade?(response)) ? response : nil
end