Sha256: 6022412dfe4c791aff956029e229f023e0a7100601fc51d1df95e29c55464f82

Contents?: true

Size: 580 Bytes

Versions: 1

Compression:

Stored size: 580 Bytes

Contents

class Tarquinn::Engine
  attr_reader :configs, :controller

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

  def perform_redirect
    return unless perform_redirect?
    handler_redirector.redirect
  end

  private

  def perform_redirect?
    handler_redirector.present?
  end

  def handler_redirector
    @handler_redirector ||= handlers.find { |h| h.perform_redirect? }
  end

  def handlers
    @handlers ||= build_handlers
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tarquinn-0.1.0 lib/tarquinn/engine.rb