Sha256: a9b63757c31a6cf43937ce9118feb86c3d460f2a453e9382433f7c0b67e30e9b

Contents?: true

Size: 515 Bytes

Versions: 2

Compression:

Stored size: 515 Bytes

Contents

class Tarquinn::Engine
  attr_reader :configs, :controller

  def initialize(configs, controller)
    @configs = configs
    @controller = controller
  end

  def perform_redirect?
    handlers.any? { |h| h.perform_redirect? }
  end

  def perform_redirect
    return unless perform_redirect?
    handlers.find { |h| h.perform_redirect? }.redirect
  end

  private

  def handlers
    @handlers ||= build_handlers
  end

  def build_handlers
    configs.map { |_,c| Tarquinn::Handler.new(c, controller) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tarquinn-0.0.2 lib/tarquinn/engine.rb
tarquinn-0.0.1 lib/tarquinn/engine.rb